From a3dd1c2798ba4f9867de7faaa9a026730f1ba7b4 Mon Sep 17 00:00:00 2001 From: Paul Yu Date: Thu, 8 Feb 2024 17:09:30 -0800 Subject: [PATCH] ci: publish helm chart to resolve #106 --- .github/workflows/package-helm-chart.yaml | 47 +++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/package-helm-chart.yaml diff --git a/.github/workflows/package-helm-chart.yaml b/.github/workflows/package-helm-chart.yaml new file mode 100644 index 00000000..ddbd4168 --- /dev/null +++ b/.github/workflows/package-helm-chart.yaml @@ -0,0 +1,47 @@ +name: package-helm-chart + +on: + push: + branches: + - main + paths: + - 'charts/**' + + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + package-helm-chart: + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set environment variables + id: set-variables + run: | + echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" + echo "VERSION=$(yq -r .version ./charts/aks-store-demo/Chart.yaml)" >> "$GITHUB_OUTPUT" + + - name: Env variable output + id: test-variables + run: | + echo ${{ steps.set-variables.outputs.REPOSITORY }} + echo ${{ steps.set-variables.outputs.VERSION }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: Package and push helm chart + run: | + helm package ./charts/aks-store-demo --version ${{ steps.set-variables.outputs.VERSION }} + helm push ./aks-store-demo-chart-${{ steps.set-variables.outputs.VERSION }}.tgz oci://${{ steps.set-variables.outputs.REPOSITORY }}/charts \ No newline at end of file