This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-07-27 11:17:39 +02:00
parent f5d7891eff
commit 2e4069a728
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC

View file

@ -11,18 +11,22 @@ on:
- "charts/**"
jobs:
collect-changes:
release-charts:
runs-on: ubuntu-22.04
outputs:
changesDetected: ${{ steps.filter.outputs.chartsAddedOrModified }}
addedOrModifiedCharts: ${{ steps.filter-charts.outputs.addedOrModifiedCharts }}
steps:
- name: Checkout
- name: Get k8s-at-home token
id: get-app-token
uses: getsentry/action-github-app-token@v1
with:
app_id: ${{ secrets.BJWS_APP_ID }}
private_key: ${{ secrets.BJWS_APP_PRIVATE_KEY }}
- name: Checkout charts branch
uses: actions/checkout@v3
with:
token: ${{ steps.get-app-token.outputs.token }}
path: 'src'
fetch-depth: 0
- name: Collect changes
uses: dorny/paths-filter@v2
@ -31,7 +35,7 @@ jobs:
list-files: shell
filters: |
chartsAddedOrModified:
- added|modified: 'charts/*/**'
- added|modified: 'src/charts/*/**'
- name: Collect changed charts
if: |
@ -52,27 +56,6 @@ jobs:
# Set output to changed charts
printf "::set-output name=addedOrModifiedCharts::%s\n" "${CHARTS[*]}"
release-charts:
runs-on: ubuntu-22.04
needs:
- collect-changes
if:
needs.collect-changes.outputs.changesDetected == 'true'
steps:
- name: Get k8s-at-home token
id: get-app-token
uses: getsentry/action-github-app-token@v1
with:
app_id: ${{ secrets.BJWS_APP_ID }}
private_key: ${{ secrets.BJWS_APP_PRIVATE_KEY }}
- name: Checkout charts branch
uses: actions/checkout@v3
with:
token: ${{ steps.get-app-token.outputs.token }}
path: 'src'
fetch-depth: 0
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
@ -89,7 +72,7 @@ jobs:
env:
SRC_DIR: "src/charts"
DEST_DIR: "dest"
CHARTS: "${{ needs.collect-changes.outputs.addedOrModifiedCharts }}"
CHARTS: "${{ steps.filter-charts.outputs.addedOrModifiedCharts }}"
run: |
for CHART in $CHARTS ; do
mapfile -t CHART_PATH_PARTS < <(echo "$CHART" | tr '/' '\n')
@ -99,19 +82,19 @@ jobs:
helm package "$CHART" -u -d "$DEST_DIR/$CHART_TYPE"
done
- name: Create new index
shell: bash
working-directory: dest
run: |
helm repo index . --url https://bjw-s.github.io/helm-charts/
# - name: Create new index
# shell: bash
# working-directory: dest
# run: |
# helm repo index . --url https://bjw-s.github.io/helm-charts/
- name: Push changes
shell: bash
working-directory: dest
run: |
git config user.name "bjw-s-bot[bot]"
git config user.email "bjw-s-bot <87358111+bjw-s-bot[bot]@users.noreply.github.com>"
git add $(git ls-files -o --exclude-standard)
git add index.yaml
git commit -m "Updated from ref: $GITHUB_SHA"
git push
# - name: Push changes
# shell: bash
# working-directory: dest
# run: |
# git config user.name "bjw-s-bot[bot]"
# git config user.email "bjw-s-bot <87358111+bjw-s-bot[bot]@users.noreply.github.com>"
# git add $(git ls-files -o --exclude-standard)
# git add index.yaml
# git commit -m "Updated from ref: $GITHUB_SHA"
# git push