Merge pull request #4241 from lszczepaniak-XM/helm-add-extra-containe… #121
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: Release Charts | |
| # See https://github.com/helm/chart-releaser-action | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - charts/** | |
| - '!charts/**/README.md' | |
| # For manual dispatch | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| release: | |
| permissions: | |
| contents: write # need to write a commit to the repo | |
| packages: write # need to push chart to ghcr | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| - name: Install Helm | |
| uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0 | |
| - name: Prepare GPG key | |
| run: | | |
| gpg_dir=.cr-gpg | |
| mkdir "$gpg_dir" | |
| # referring keyring to private key of gpg | |
| keyring="$gpg_dir/secring.gpg" | |
| # storing base64 GPG key into keyring | |
| base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring" | |
| passphrase_file="$gpg_dir/passphrase" | |
| # storing passphrase data into a file | |
| echo "$GPG_PASSPHRASE" > "$passphrase_file" | |
| # saving passphrase into github-environment | |
| echo "CR_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV" | |
| # saving private key into github-environemnt | |
| echo "CR_KEYRING=$keyring" >> "$GITHUB_ENV" | |
| env: | |
| GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}" #Referring secrets of github above | |
| GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}" | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run chart-releaser | |
| uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0 | |
| env: | |
| CR_TOKEN: "${{ github.token }}" | |
| CR_KEY: "${{ secrets.GPG_SIGNING_KEY_NAME }}" # Name used while creating key | |
| CR_SIGN: true # set to true to sign images | |
| with: | |
| config: .github/cr.yaml | |
| mark_as_latest: false # only headlamp is set to latest | |
| skip_existing: true # skip package upload if release already exists | |
| - name: Push Charts to GHCR | |
| run: | | |
| for pkg in .cr-release-packages/*; do | |
| if [ -z "${pkg:-}" ]; then | |
| break | |
| fi | |
| helm push "${pkg}" oci://ghcr.io/${{ github.repository }}/charts | |
| done |