@@ -19,21 +19,27 @@ cd charts/charts/datagovuk/images
1919
2020for ENV in $( echo $ENVS | tr " ," " " ) ; do
2121 (
22- BRANCH=" ci/${IMAGE_TAG} -${ENV} "
23-
24- if git show-ref --quiet refs/heads/${BRANCH} ; then
25- echo " Branch ${BRANCH} already exists on govuk-dgu-charts"
26- else
22+ cd " ${ENV} "
23+ yq -i ' .tag = env(IMAGE_TAG)' " find.yaml"
24+ yq -i ' .branch = env(SOURCE_BRANCH)' " find.yaml"
25+ git add " find.yaml"
26+
27+ if [[ $( git status | grep " nothing to commit" ) ]]; then
28+ echo " Nothing to commit"
29+ elif [[ " ${DIRECT_PUSH:- false} " == " true" ]]; then
30+ BRANCH=" ci/${IMAGE_TAG} -${ENV} "
2731 git checkout -b ${BRANCH}
32+ git commit -m " Update datagovuk_find image tags for ${ENV} to ${IMAGE_TAG} "
33+ git push --set-upstream origin " ${BRANCH} "
34+ PR_URL=$( gh pr create --title " Update datagovuk_find image tags for ${ENV} (${IMAGE_TAG} )" --base main --head " ${BRANCH} " --fill --repo alphagov/govuk-dgu-charts)
35+ gh pr merge " ${PR_URL} " --merge --delete-branch
36+ else
37+ BRANCH=" ci/${IMAGE_TAG} -${ENV} "
2838
29- cd " ${ENV} "
30- yq -i ' .tag = env(IMAGE_TAG)' " find.yaml"
31- yq -i ' .branch = env(SOURCE_BRANCH)' " find.yaml"
32- git add " find.yaml"
33-
34- if [[ $( git status | grep " nothing to commit" ) ]]; then
35- echo " Nothing to commit"
39+ if git show-ref --quiet refs/heads/${BRANCH} ; then
40+ echo " Branch ${BRANCH} already exists on govuk-dgu-charts"
3641 else
42+ git checkout -b ${BRANCH}
3743 git commit -m " Update datagovuk_find image tags for ${ENV} to ${IMAGE_TAG} "
3844 git push --set-upstream origin " ${BRANCH} "
3945 gh pr create --title " Update datagovuk_find image tags for ${ENV} (${IMAGE_TAG} )" --base main --head " ${BRANCH} " --fill
0 commit comments