Readur/.github/workflows/helm-release.yml

57 lines
1.9 KiB
YAML

name: helm-release
on:
push:
tags:
- "chart-v*"
jobs:
release:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
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: validate chart version
id: version
run: |
tag_version="${GITHUB_REF#refs/tags/chart-v}"
chart_version=$(yq '.version' charts/readur/Chart.yaml)
if [[ "$chart_version" == "$tag_version" ]]; then
echo "should_release=true" >> $GITHUB_OUTPUT
echo "Chart version $chart_version matches tag chart-v$tag_version"
else
echo "should_release=false" >> $GITHUB_OUTPUT
echo "Error: Chart version ($chart_version) does not match tag version ($tag_version)"
exit 1
fi
- name: run chart-releaser
id: cr
if: ${{ steps.version.outputs.should_release == 'true' }}
uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_GENERATE_RELEASE_NOTES: true
CR_SKIP_EXISTING: true
- name: Login to GitHub Container Registry
if: ${{ steps.version.outputs.should_release == 'true' }}
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ steps.version.outputs.should_release == 'true' }}
name: Push Chart
run: helm push .cr-release-packages/readur-*.tgz oci://ghcr.io/${{ github.repository }}