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