Skip to content

Commit 241803a

Browse files
Update image tag and push to branch in kustomize-ci workflow
1 parent 32a479a commit 241803a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/kustomize-ci.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,29 @@ jobs:
7171
git config --global user.name "${{ secrets.GIT_USER_NAME }}"
7272
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}"
7373
74-
- name: Update image tag
74+
- name: Update image tag and push to branch
7575
run: |
7676
if [ -z "$IMAGE_TAG" ]; then
77-
echo " IMAGE_TAG is empty, exiting."
77+
echo "IMAGE_TAG is empty, exiting."
7878
exit 1
7979
fi
8080
81+
git fetch origin auto/kustomize-update || true
82+
git pull origin auto/kustomize-update --rebase || true
83+
8184
FILE="kustomize/overlays/dev/patch-deployment-image.yaml"
8285
echo "Updating $FILE with image: $IMAGE_NAME:$IMAGE_TAG"
8386
8487
sed -i.bak -E "s|image:.*|image: ${IMAGE_NAME}:${IMAGE_TAG}|" "$FILE"
8588
8689
git add "$FILE"
87-
git commit -m "Update image tag to $IMAGE_TAG"
88-
89-
git push origin HEAD:auto/kustomize-update --force-with-lease
90+
git commit -m "Update image tag to $IMAGE_TAG" || echo "No changes to commit"
9091
9192
93+
git push origin HEAD:auto/kustomize-update --force-with-lease
94+
env:
95+
IMAGE_NAME: yourdockerhub/springboot-postgres
96+
IMAGE_TAG: ${{ needs.build-and-push.outputs.image-tag }}
9297

9398

9499

0 commit comments

Comments
 (0)