44 push :
55 branches :
66 - ' main'
7- tags :
8- - ' *'
97 pull_request :
108
119jobs :
1917 uses : crazy-max/ghaction-docker-meta@v5.7.0
2018 with :
2119 images : ghcr.io/${{ github.repository }}
20+ tags : |
21+ type=sha
2222 - name : Set up QEMU
2323 uses : docker/setup-qemu-action@v3
2424 - name : Set up Docker Buildx
@@ -53,37 +53,29 @@ jobs:
5353 push : ${{ github.event_name != 'pull_request' }}
5454 tags : ${{ steps.docker_meta.outputs.tags }}
5555 labels : ${{ steps.docker_meta.outputs.labels }}
56-
57- - name : Check whether wbaas-deploy should be updated
58- id : update-check
59- run : |
60- if [[ "$GITHUB_REF" =~ ^refs/tags/.+$ ]]; then
61- echo "This is a tagged release, will try to create an update in wbaas-deploy."
62- echo "match=true" >> $GITHUB_OUTPUT
63- fi
6456 - name : Check out `wmde/wbaas-deploy` repository in staging child directory
65- if : steps.update-check.outputs.match == 'true '
57+ if : github.event_name != 'pull_request '
6658 uses : actions/checkout@v4
6759 with :
6860 repository : wmde/wbaas-deploy
6961 path : ./repos/wbaas-deploy-staging
7062 - name : Check out `wmde/wbaas-deploy` repository in production child directory
71- if : steps.update-check.outputs.match == 'true '
63+ if : github.event_name != 'pull_request '
7264 uses : actions/checkout@v4
7365 with :
7466 repository : wmde/wbaas-deploy
7567 path : ./repos/wbaas-deploy-production
7668 - name : Update values for local, staging and production
77- if : steps.update-check.outputs.match == 'true '
69+ if : github.event_name != 'pull_request '
7870 id : update-values
7971 run : |
80- TAG="$GITHUB_REF_NAME "
72+ TAG="$(echo ${{ steps.docker_meta.outputs.tags }} | cut -d':' -f2) "
8173 echo "tag=$TAG" >> $GITHUB_OUTPUT
8274 sed -i "/image:/{n;s/tag:.*/tag: $TAG/;}" ./repos/wbaas-deploy-staging/k8s/helmfile/env/local/api.values.yaml.gotmpl
8375 sed -i "/image:/{n;s/tag:.*/tag: $TAG/;}" ./repos/wbaas-deploy-staging/k8s/helmfile/env/staging/api.values.yaml.gotmpl
8476 sed -i "/image:/{n;s/tag:.*/tag: $TAG/;}" ./repos/wbaas-deploy-production/k8s/helmfile/env/production/api.values.yaml.gotmpl
8577 - name : Update argo values for local, staging and production
86- if : steps.update-check.outputs.match == 'true '
78+ if : github.event_name != 'pull_request '
8779 id : update-argo-values
8880 run : |
8981 cd ./repos/wbaas-deploy-staging
@@ -95,14 +87,14 @@ jobs:
9587 cd ../wbaas-deploy-production
9688 ./bin/generate-values production api
9789 - name : Truncate commit message
98- if : steps.update-check.outputs.match == 'true '
90+ if : github.event_name != 'pull_request '
9991 id : truncate-commit-message
10092 run : |
101- MSG=$(echo "${{ github.event.head_commit.message }}" | head -n 1 )
93+ MSG=$(git log -1 --pretty=format:%s )
10294 echo "msg=$MSG" >> $GITHUB_OUTPUT
10395 - name : Create Staging+Local Pull Request
10496 uses : peter-evans/create-pull-request@v7
105- if : steps.update-check.outputs.match == 'true '
97+ if : github.event_name != 'pull_request '
10698 with :
10799 path : ./repos/wbaas-deploy-staging
108100 commit-message : ' Staging+Local: Deploy new Platform API image ${{ steps.update-values.outputs.tag }}'
@@ -118,7 +110,7 @@ jobs:
118110 **Changes**: [${{ steps.truncate-commit-message.outputs.msg }}](https://github.com/wbstack/api/commit/${{ github.sha }})
119111 - name : Create Production Pull Request
120112 uses : peter-evans/create-pull-request@v7
121- if : steps.update-check.outputs.match == 'true '
113+ if : github.event_name != 'pull_request '
122114 with :
123115 path : ./repos/wbaas-deploy-production
124116 commit-message : ' Production: Deploy new Platform API image ${{ steps.update-values.outputs.tag }}'
0 commit comments