Skip to content

Commit

Permalink
Merge pull request #23 from mruoss/push-chart-only-on-git-tag-match
Browse files Browse the repository at this point in the history
only push helm chart on git tag
  • Loading branch information
mruoss authored Jan 12, 2025
2 parents cc415d3 + 17de163 commit 2cad863
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/helm_chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
workflow_dispatch:
push:
branches: [main]
tags: ["*"]
pull_request:

env:
Expand Down Expand Up @@ -30,18 +31,22 @@ jobs:
- name: helm login
run: |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io -u $ --password-stdin
- name: helm package
if: ${{ github.event_name != 'push' }}
run: helm package .
- name: helm package
if: ${{ github.event_name == 'push' }}
run: |
echo "${{ secrets.CHART_SIGN_PRIVATE_KEY }}" | gpg --dearmor --output keyring.gpg
helm package --sign --key 'Michael Ruoss (Livebook Helm Package Signing)' --keyring keyring.gpg .
- name: helm push
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
run: |
helm push livebook-*.tgz oci://ghcr.io/${{ github.repository_owner }}/charts
git_tag = $(git describe --tags --abbrev=0)
chart_tag = $(yq '.version' Chart.yaml)
if [[ "$git_tag" == "v${chart_tag}" ]]; then
helm push livebook-*.tgz oci://ghcr.io/${{ github.repository_owner }}/charts
else
echo "Git Tag and Chart.yaml version mismatch!"
exit 1
fi
- name: Upload artifacthub-repo.yml
run: |
echo ${{ secrets.GITHUB_TOKEN }} | oras login ghcr.io -u mruoss --password-stdin
Expand Down

0 comments on commit 2cad863

Please sign in to comment.