1313
1414 env :
1515 IMAGE_NAME : ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres
16+ IMAGE_TAG : ${{ needs.build-and-push.outputs.image-tag }}
1617
1718 steps :
1819 - name : Checkout code
@@ -45,33 +46,22 @@ jobs:
4546
4647 docker build -t $IMAGE_NAME:$TAG ./app
4748 docker push $IMAGE_NAME:$TAG
49+ - name : Checkout code
50+ uses : actions/checkout@v4
4851
49- update-kustomize :
50- name : Update Kustomize Overlay
51- needs : build-and-push
52- runs-on : ubuntu-latest
53-
54- env :
55- IMAGE_NAME : ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres
56- IMAGE_TAG : ${{ needs.build-and-push.outputs.image-tag }}
57-
58- steps :
59- - name : Checkout code
60- uses : actions/checkout@v4
61-
62- - name : Update image tag in dev overlay
63- run : |
52+ - name : Update image tag in dev overlay
53+ run : |
6454 FILE="kustomize/overlays/dev/patch-deployment-image.yaml"
6555
6656 echo "Updating $FILE with image: $IMAGE_NAME:$IMAGE_TAG"
6757
6858 sed -i.bak -E "s|image:.*|image: ${IMAGE_NAME}:${IMAGE_TAG}|" "$FILE"
6959
70- - name : Commit and push changes
71- env :
72- TOKEN : ${{ secrets.GH_PAT }}
73- IMAGE_TAG : ${{ env.IMAGE_TAG }}
74- run : |
60+ - name : Commit and push changes
61+ env :
62+ TOKEN : ${{ secrets.GH_PAT }}
63+ IMAGE_TAG : ${{ env.IMAGE_TAG }}
64+ run : |
7565 git config --global user.name ${{ secrets.GIT_USER_EMAIL }}
7666 git config --global user.email ${{ secrets.GIT_USER_NAME }}
7767
8070
8171 git add kustomize/overlays/dev/patch-deployment-image.yaml
8272 git commit -m "Update latest image tag to $IMAGE_TAG"
83- git push
73+ git push
74+
75+
76+ # update-kustomize:
77+ # name: Update Kustomize Overlay
78+ # needs: build-and-push
79+ # runs-on: ubuntu-latest
80+
81+ # env:
82+ # IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/springboot-postgres
83+ # IMAGE_TAG: ${{ needs.build-and-push.outputs.image-tag }}
84+
85+ # steps:
86+ # - name: Checkout code
87+ # uses: actions/checkout@v4
88+
89+ # - name: Update image tag in dev overlay
90+ # run: |
91+ # FILE="kustomize/overlays/dev/patch-deployment-image.yaml"
92+
93+ # echo "Updating $FILE with image: $IMAGE_NAME:$IMAGE_TAG"
94+
95+ # sed -i.bak -E "s|image:.*|image: ${IMAGE_NAME}:${IMAGE_TAG}|" "$FILE"
96+
97+ # - name: Commit and push changes
98+ # env:
99+ # TOKEN: ${{ secrets.GH_PAT }}
100+ # IMAGE_TAG: ${{ env.IMAGE_TAG }}
101+ # run: |
102+ # git config --global user.name ${{ secrets.GIT_USER_EMAIL }}
103+ # git config --global user.email ${{ secrets.GIT_USER_NAME }}
104+
105+ # git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}.git
106+
107+
108+ # git add kustomize/overlays/dev/patch-deployment-image.yaml
109+ # git commit -m "Update latest image tag to $IMAGE_TAG"
110+ # git push
0 commit comments