diff --git a/.github/workflows/release-push-image.yaml b/.github/workflows/release-push-image.yaml index a072e42b..5ec8741b 100644 --- a/.github/workflows/release-push-image.yaml +++ b/.github/workflows/release-push-image.yaml @@ -109,3 +109,49 @@ jobs: VERSION=${{ env.VERSION }} build-contexts: | distributions=./server/build/distributions + + + helm-chart-release: + runs-on: [ self-hosted, Linux, medium, ephemeral ] + + steps: + - name: Harden Runner + uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Get tag + run: | + if [[ "${{ github.event.inputs.version }}" ]]; then + echo "TAG=${{ github.event.inputs.version }}" >> $GITHUB_ENV + elif [[ "$GITHUB_REF_TYPE" == "tag" ]]; then + echo "TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + else + echo "TAG=main" >> $GITHUB_ENV + fi + + - name: Extract version + id: extract_version + run: | + VERSION=$(grep 'version=' gradle.properties | cut -d '=' -f2) + echo "VERSION=${VERSION}" >> $GITHUB_ENV + + - name: Install Helm + uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0 + + - name: Use yq to update image tag + uses: mikefarah/yq-action@35f5ee3ef7d47ba98e50d8a07bc0d6d124e0517e # Reference by hash + with: + cmd: "yq eval '.image.tag = strenv(TAG)' -i charts/hedera-block-node/values.yaml" + env: + TAG: ${{ env.TAG }} + + - name: Publish helm chart + uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 # v1.7.0 + with: + target_dir: charts + token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-pages