test-helm-chart #2
Workflow file for this run
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: Publish Helm Chart | |
on: | |
release: | |
types: [published] | |
branches: | |
- main | |
- helm-chart | |
env: | |
REGISTRY: ghcr.io | |
CHART_DIR: chart | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.12.3 | |
- name: Update Chart Version | |
run: | | |
# Get version from release tag | |
VERSION=${GITHUB_REF#refs/tags/} | |
# Update version in Chart.yaml | |
yq e -i '.version = "'${VERSION}'"' ${{ env.CHART_DIR }}/Chart.yaml | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Package Helm Chart | |
run: | | |
helm package ${{ env.CHART_DIR }} | |
- name: Push Helm Chart | |
run: | | |
# Get chart name from Chart.yaml | |
CHART_NAME=$(yq e '.name' ${{ env.CHART_DIR }}/Chart.yaml) | |
VERSION=${GITHUB_REF#refs/tags/} | |
# Push to GHCR using Helm | |
helm push "${CHART_NAME}-${VERSION}.tgz" oci://${{ env.REGISTRY }}/${{ github.repository_owner }} |