Publish OCI charts #101
This file contains hidden or 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: Publish OCI charts | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| index_path: | |
| description: 'OCI index-latest.yaml path, without registry hostname' | |
| required: true | |
| env: | |
| REGISTRY: quay.io | |
| jobs: | |
| helmchart-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| fetch-depth: 0 | |
| - name: Setup Oras | |
| uses: oras-project/setup-oras@v1 | |
| - name: Download index-latest.yaml from workflow input | |
| #uses: mikefarah/yq@master | |
| run: | | |
| oras pull ${REGISTRY}/${{ inputs.index_path }} | |
| cat index-latest.yaml | |
| - name: Get index-latest.yaml chart name | |
| id: get_chart_name | |
| uses: mikefarah/yq@master | |
| with: | |
| cmd: yq '.entries | to_entries[0] | (.key)' index-latest.yaml | |
| - name: Get index-latest.yaml chart version | |
| id: get_chart_version | |
| uses: mikefarah/yq@master | |
| with: | |
| cmd: yq '.entries | to_entries[0] | (.value[0].version)' index-latest.yaml | |
| - name: Remove potential duplicate prior to merge | |
| uses: mikefarah/yq@master | |
| with: | |
| cmd: yq -i 'del(.entries.["${{ steps.get_chart_name.outputs.result }}"][] | select(.version == "${{ steps.get_chart_version.outputs.result }}"))' index.yaml | |
| - name: Merge index-latest.yaml into index.yaml | |
| uses: mikefarah/yq@master | |
| with: | |
| cmd: yq -i eval-all 'select(fi == 0) *++ select(fi == 1) | select(fi == 0)' index.yaml index-latest.yaml | |
| - name: Commit changes | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: Publish chart ${{ steps.get_chart_name.outputs.result }} version ${{ steps.get_chart_version.outputs.result }} | |
| branch: gh-pages | |
| file_pattern: 'index.yaml' | |
| skip_fetch: true | |
| skip_checkout: true |