From 9dc3eed0bc28970049cb58035f93629bf8b18a56 Mon Sep 17 00:00:00 2001 From: Niklas Treml Date: Thu, 18 Jan 2024 17:43:13 +0100 Subject: [PATCH] feat: package helm chart on push (#74) * feat: package helm chart on push * fix: semver compatible chart version * fix: typo --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62d232b0..1232c32f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Contiuous Integration +name: Continuous Integration on: push: @@ -61,4 +61,35 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Push snapshot container image - run: docker push ghcr.io/caas-team/sparrow:${{ steps.version.outputs.value }} \ No newline at end of file + run: docker push ghcr.io/caas-team/sparrow:${{ steps.version.outputs.value }} + helm: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + fetch-tags: true + + - name: Fetch tags explicitly + run: git fetch --tags + + - name: Get App Version + id: appVersion + run: echo "value=commit-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Get Chart Version + id: chartVersion + # produces a tag like: 0.2.2-commit-asdf3 + run: echo "value=$(git tag --sort=taggerdate | tail -1 | cut -c 2-)-commit-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Registry login + run: helm registry login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} + + - name: Helm lint + run: helm lint ./chart + + - name: Helm package + run: helm package ./chart -d ./chart --version ${{ steps.chartVersion.outputs.value }} --app-version ${{ steps.appVersion.outputs.value }} + + - name: Push helm package + run: helm push $(ls ./chart/*.tgz| head -1) oci://ghcr.io/${{ github.repository_owner }}/charts