From b3da4d604f709477b0ded36eb726a4f1565660de Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 2 Dec 2024 04:14:40 -0800 Subject: [PATCH] added update-helm-charts job in production wf (#174) --- .../workflows/build-publish-production.yaml | 49 +++++++++++++++++++ .github/workflows/build-publish-staging.yaml | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-publish-production.yaml b/.github/workflows/build-publish-production.yaml index 753f58077..e29314622 100644 --- a/.github/workflows/build-publish-production.yaml +++ b/.github/workflows/build-publish-production.yaml @@ -14,6 +14,7 @@ jobs: runs-on: ubuntu-latest outputs: image_version: ${{ env.IMAGE_SEMVER }} + commit_hash: ${{ steps.export_commit_hash.outputs.commit_hash }} steps: - name: Checkout @@ -27,10 +28,18 @@ jobs: - name: Install NodeJS Dependencies run: npm install + - name: Get Commit Hash + id: commit_hash + uses: prompt/actions-commit-hash@v3 + - name: Build Version Tag id: build_version_tag run: echo "IMAGE_SEMVER=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Export Commit Hash + id: export_commit_hash + run: echo "commit_hash=${{ steps.commit_hash.outputs.short }}" >> $GITHUB_OUTPUT + - name: Build Container Image Metadata id: meta uses: docker/metadata-action@v5 @@ -83,4 +92,44 @@ jobs: labels: ${{ steps.meta.outputs.labels }} annotations: ${{ steps.meta.outputs.annotations }} + update-helm-charts: + needs: [build-stable] + environment: stable + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + # - name: Create GitHub App Token + # id: app-token + # uses: actions/create-github-app-token@v1 + # with: + # app-id: ${{ secrets.APP_ID }} + # private-key: ${{ secrets.APP_KEY }} + - name: Checkout Charts Repo + uses: actions/checkout@v4 + with: + repository: "${{ vars.DOCS_NEXT_CHARTS_ORG }}/${{ vars.DOCS_NEXT_CHARTS_REPO }}" + token: ${{ secrets.DOCS_NEXT_TOKEN }} + - name: Commit Changes + env: + image: ${{ vars.REGISTRY }}/${{ vars.REGISTRY_ORG }}/${{ vars.IMG_NAME }} + tag: ${{ needs.build-stable.outputs.image_version }} + run: | + git config --global user.name 'otcbot' + git config --global user.email 'otc_ecosystem_squad@t-systems.com' + sed -i 's|^version: .*|version: 0.3.${{github.run_number}}|' ./charts/docusaurus/Chart.yaml + sed -i 's|^appVersion: .*|appVersion:${{ env.tag }}/' ./charts/docusaurus/Chart.yaml + sed -i 's|^tag: .*|tag: ${{ env.tag }}|' ./charts/docusaurus/values-prod.yaml + sed -i 's|^image: .*|image: ${{ env.image }}|' ./charts/docusaurus/values-prod.yaml + git commit -am "Automatic commit from GitHub Actions triggered by action ${{github.run_number}}" + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + env: + remote_pr_branch: 'release/production-${{ needs.build-stable.outputs.image_version }}' + with: + title: ${{ env.remote_pr_branch }} + token: ${{ secrets.DOCS_NEXT_TOKEN }} + branch: ${{ env.remote_pr_branch }} \ No newline at end of file diff --git a/.github/workflows/build-publish-staging.yaml b/.github/workflows/build-publish-staging.yaml index fd55c5705..6402a4781 100644 --- a/.github/workflows/build-publish-staging.yaml +++ b/.github/workflows/build-publish-staging.yaml @@ -122,7 +122,7 @@ jobs: git config --global user.email 'otc_ecosystem_squad@t-systems.com' sed -i 's|^tag: .*|tag: ${{ env.tag }}|' ./charts/docusaurus/values-stg.yaml sed -i 's|^image: .*|image: ${{ env.image }}|' ./charts/docusaurus/values-stg.yaml - git commit -am "Automatic commit from GitHub Actions triggered by action #${{github.run_number}}" + git commit -am "Automatic commit from GitHub Actions triggered by action ${{github.run_number}}" - name: Create Pull Request uses: peter-evans/create-pull-request@v7 env: