From c9cfe7e092edad8e144ceca8fc12c1ea72cdc466 Mon Sep 17 00:00:00 2001 From: anton Date: Tue, 2 Apr 2024 22:34:08 +0200 Subject: [PATCH] Added github actions workflow to package and push helm chart --- .../package_and_push_helm_chart.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/package_and_push_helm_chart.yaml diff --git a/.github/workflows/package_and_push_helm_chart.yaml b/.github/workflows/package_and_push_helm_chart.yaml new file mode 100644 index 0000000..ba9a210 --- /dev/null +++ b/.github/workflows/package_and_push_helm_chart.yaml @@ -0,0 +1,58 @@ +name: Package and Push Helm Chart + +on: + push: + branches: + - dev + - release + workflow_dispatch: + inputs: + name: + description: "Manual trigger for Helm chart packaging and pushing" + release_type: + description: "Release or snapshot version?" + required: true + default: "SNAPSHOT" + options: + - "SNAPSHOT" + - "RELEASE" + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Helm + uses: azure/setup-helm@v4.1.0 + with: + version: ${{ vars.HELM_VERSION }} + + - name: Login with Helm + run: | + echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ vars.HELM_REGISTRY }} --username ${{ github.repository_owner }} --password-stdin + + - name: Add/update Helm dependencies + run: | + helm repo add codecentric https://codecentric.github.io/helm-charts + helm dependency update "charts/fairspace-keycloak" + + - name: Prepare version + run: | + VERSION=$(cat ./VERSION) + if [[ ${{ github.event.inputs.release_type }} = "SNAPSHOT" ]] || [[ $BRANCH = "dev" ]]; then + VERSION=$VERSION-SNAPSHOT + fi + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Package and Push Helm chart to repository + run: | + helm package "charts/fairspace-keycloak" --version ${{ env.VERSION }} + helm push "fairspace-keycloak-${{ env.VERSION }}.tgz" "oci://${{ vars.HELM_REGISTRY }}" + echo "Pushed package to repository" + + - name: Clean up + run: | + rm -rf "fairspace-keycloak*.tgz"