From ad0ed69f638fe16a2ad1412edc97fd949ba2586a Mon Sep 17 00:00:00 2001 From: Vedran Pugar <72854396+vpugar-digital@users.noreply.github.com> Date: Wed, 26 Apr 2023 20:12:20 +0200 Subject: [PATCH] S-90923 Renaming the workflows (#6) --- .github/workflows/publish_helm_chart_repo.yml | 40 ------------------- ...publish_helm_chart_gcr.yml => release.yml} | 25 +++++++++--- 2 files changed, 19 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/publish_helm_chart_repo.yml rename .github/workflows/{publish_helm_chart_gcr.yml => release.yml} (59%) diff --git a/.github/workflows/publish_helm_chart_repo.yml b/.github/workflows/publish_helm_chart_repo.yml deleted file mode 100644 index db77ffc..0000000 --- a/.github/workflows/publish_helm_chart_repo.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Publish Helm Chart (Github) - -on: - workflow_dispatch: - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Chart Checkout - uses: actions/checkout@v3 - - name: Helm Installation - uses: azure/setup-helm@v1.1 - with: - version: v3.7.0 - - name: Helm Repository Checkout - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - fetch-depth: 0 - persist-credentials: true - ref: master - - name: Helm Package (Github) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - CHART_VERSION=$(helm show chart . | grep "^version:" | awk '$1 { print $2 }') - helm repo add bitnami https://charts.bitnami.com/bitnami - helm repo update - helm dependency update - helm package . --version "$CHART_VERSION" -d helm - helm repo index . - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - git config --global user.name "${{ github.actor }}" - CHART_PACKAGE_NAME="remote-runner-$CHART_VERSION" - git add "helm/$CHART_PACKAGE_NAME.tgz" - git add index.yaml - git commit -m "publish $CHART_PACKAGE_NAME" - git push origin master - diff --git a/.github/workflows/publish_helm_chart_gcr.yml b/.github/workflows/release.yml similarity index 59% rename from .github/workflows/publish_helm_chart_gcr.yml rename to .github/workflows/release.yml index 115621d..22c6c38 100644 --- a/.github/workflows/publish_helm_chart_gcr.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Publish Helm Chart (GCR) +name: Release Helm Chart on: release: @@ -13,7 +13,7 @@ jobs: - name: Helm Installation uses: azure/setup-helm@v1.1 with: - version: v3.7.0 + version: v3.11.3 - name: Helm Repository Checkout uses: actions/checkout@v3 with: @@ -21,6 +21,12 @@ jobs: fetch-depth: 0 persist-credentials: true ref: master + - name: Setup Env + run: | + CHART_VERSION=$(helm show chart . | grep "^version:" | awk '$1 { print $2 }') + CHART_PACKAGE_NAME="remote-runner-$CHART_VERSION" + echo "CHART_VERSION=$CHART_VERSION" >> "$GITHUB_ENV" + echo "CHART_PACKAGE_NAME=$CHART_PACKAGE_NAME" >> "$GITHUB_ENV" - name: Helm Package (GCR) env: # experimental feature @@ -28,11 +34,18 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GCR_IMAGE: ghcr.io/${{ github.repository_owner }}/xlr-remote-runner-helm-chart run: | - CHART_VERSION=$(helm show chart . | grep "^version:" | awk '$1 { print $2 }') - CHART_PACKAGE_NAME="remote-runner-$CHART_VERSION" helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update helm dependency update - helm package . --version "$CHART_VERSION" -d build + helm package . --version "${{ env.CHART_VERSION }}" -d build echo ${{ env.GITHUB_TOKEN }} | helm registry login ${{ env.GCR_IMAGE }} --username ${{ github.repository_owner }} --password-stdin - helm push build/$CHART_PACKAGE_NAME.tgz oci://${{ env.GCR_IMAGE }} + helm push build/${{ env.CHART_PACKAGE_NAME }}.tgz oci://${{ env.GCR_IMAGE }} + - name: Upload Release Helm Chart + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: build/${{ env.CHART_PACKAGE_NAME }}.tgz + asset_name: ${{ env.CHART_PACKAGE_NAME }}.tgz + asset_content_type: application/gzip