From 76fc556f815f7eea3b989e23fb98def0a1a5d913 Mon Sep 17 00:00:00 2001 From: Idhibhat Pankam Date: Fri, 16 Feb 2024 21:32:49 +0700 Subject: [PATCH] feat: add auto imagetag change --- .github/workflows/build.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a0e9ba1..1c0c0db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,4 +52,28 @@ jobs: push: true tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }},${{ env.IMAGE_NAME }}:latest cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache - cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max \ No newline at end of file + cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max + + update-gitops: + name: Update gitops repository + runs-on: ubuntu-latest + + steps: + - name: Checkout gitops repository + uses: actions/checkout@v4 + with: + repository: isd-sgcu/isd-gitops + token: ${{ secrets.GITOPS_TOKEN }} + + - name: Update image tag + uses: mikefarah/yq@master + env: + NEW_TAG: ${{ github.ref_type == 'tag' && github.ref_name || env.IMAGE_TAG }} + with: + cmd: yq -i '.gateway.imageTag = strenv(NEW_TAG)' projects/johnjud/values/gateway-dev.values.yaml + + - name: Commit & Push changes + uses: actions-js/push@v1.4 + with: + github_token: ${{ secrets.GITOPS_TOKEN }} + repository: isd-sgcu/isd-gitops \ No newline at end of file