Update Helm Repository #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Helm Repository | |
on: | |
workflow_dispatch: | |
inputs: | |
repo: | |
type: choice | |
required: true | |
description: "Which repo to build?" | |
default: "stable" | |
options: | |
- "stable" | |
- "canary" | |
workflow_call: | |
inputs: | |
repo: | |
type: string | |
required: true | |
description: "Build stable or canary repo?" | |
default: "stable" | |
jobs: | |
call-make-index: | |
uses: ./.github/workflows/make-charts-index.yaml | |
with: | |
repoName: ${{ inputs.repo }} | |
update-page: | |
runs-on: ubuntu-latest | |
needs: call-make-index | |
permissions: | |
contents: write # for updating index.yaml | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: "gh-pages" | |
- name: Configure Git | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor}}@users.noreply.github.com" | |
- uses: actions/download-artifact@v3 | |
with: | |
name: "chart-index.${{ inputs.repo }}" | |
path: ".nindex" | |
- name: Update index when there's changes | |
shell: bash | |
run: | | |
if [[ "${{ inputs.repo }}" == "stable" ]]; then | |
path="." | |
else | |
path="${{ inputs.repo }}" | |
# create dir if it doesn't exist yet | |
[ ! -d "$path" ] && mkdir "$path" | |
fi | |
if ! diff -q .nindex/index.yaml "$path/index.yaml"; then | |
cp .nindex/index.yaml "$path/index.yaml" | |
git add "$path/index.yaml" | |
git commit -m "chore(helm-repo): update index.yaml" | |
git push | |
fi |