Download Helm Chart #153
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: Download Helm Chart | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| repo: | |
| type: string | |
| required: true | |
| description: 'The target repo name to fetch released chart packages. e.g. ("open-cluster-management-io/registration")' | |
| version: | |
| type: string | |
| required: true | |
| description: 'The target release to download the chart package, should be a valid semver. e.g. ("1.1.1")' | |
| chart-name: | |
| type: string | |
| required: true | |
| description: 'The chart package name which is used for finding the target asset. The downloading asset name will be "<chart-name>-<version>.tgz"' | |
| component: | |
| type: string | |
| required: false | |
| description: 'The component associated with the target release. Required for release tags of the form "<component>/v<version>"' | |
| env: | |
| # Common versions | |
| PUBLISH_BRANCH: 'main' | |
| jobs: | |
| download: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Turnstyle | |
| uses: softprops/turnstyle@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ env.PUBLISH_BRANCH }} | |
| token: ${{ secrets.OCM_BOT_PAT }} | |
| - name: Determine release tag | |
| id: release-tag | |
| run: | | |
| if [ -z "${{ github.event.inputs.component }}" ]; then | |
| echo "releaseTag=v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "releaseTag=${{ github.event.inputs.component }}/v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| fi | |
| - uses: robinraju/[email protected] | |
| with: | |
| repository: "${{ github.event.inputs.repo }}" | |
| tag: "${{ steps.release-tag.outputs.releaseTag }}" | |
| fileName: "${{ github.event.inputs.chart-name }}-${{ github.event.inputs.version }}.tgz" | |
| out-file-path: "charts/" | |
| token: ${{ secrets.OCM_BOT_PAT }} | |
| - name: Push Chart | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "[email protected]" | |
| git add . | |
| git status | |
| git commit -s \ | |
| -m "Automated upload ${{ github.event.inputs.repo }} ${{ github.event.inputs.chart-name }}-${{ github.event.inputs.version }}.tgz" | |
| git push https://${{ github.token }}@github.com/${{ github.repository }}.git ${{ env.PUBLISH_BRANCH }} |