77 - main
88
99env :
10- IMAGE_NAME : ghcr.io/developer-overheid-nl/don-site
11- INFRA_REPO : developer-overheid-nl/don-infra
12- KUSTOMIZE_PATH : apps/frontend/overlays/test
10+ IMAGE_NAME : ghcr.io/${{ github.repository }}
11+ INFRA_REPO : ${{ vars.INFRA_REPO }}
12+ KUSTOMIZE_PATH : ${{ vars.KUSTOMIZE_PATH }}
13+ DEPLOY_ENV : test
1314
1415jobs :
1516 check-keyword :
@@ -35,28 +36,27 @@ jobs:
3536 build-and-push :
3637 needs : check-keyword
3738 if : |
38- needs.check-keyword.outputs.deploy == 'true' &&
39- github.repository == 'developer-overheid-nl/don-site'
39+ needs.check-keyword.outputs.deploy == 'true'
4040 runs-on : ubuntu-latest
4141 permissions :
4242 contents : read
4343 packages : write
4444 steps :
4545 - name : Checkout
46- uses : actions/checkout@v6
46+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
4747
4848 - name : Set up Docker Buildx
49- uses : docker/setup-buildx-action@v4
49+ uses : docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
5050
5151 - name : Login to container registry
52- uses : docker/login-action@v4
52+ uses : docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2
5353 with :
5454 registry : ghcr.io
5555 username : ${{ github.actor }}
5656 password : ${{ secrets.GITHUB_TOKEN }}
5757
5858 - name : Build and push image
59- uses : docker/build-push-action@v7
59+ uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294
6060 with :
6161 context : .
6262 target : caddy
@@ -72,30 +72,48 @@ jobs:
7272 needs : build-and-push
7373 runs-on : ubuntu-latest
7474 steps :
75+ - name : Parse infra repository
76+ id : infra-repo
77+ run : |
78+ INFRA_REPO="${{ env.INFRA_REPO }}"
79+
80+ if [[ -z "$INFRA_REPO" || "$INFRA_REPO" != */* ]]; then
81+ echo "INFRA_REPO moet de vorm owner/repo hebben, huidige waarde: '$INFRA_REPO'" >&2
82+ exit 1
83+ fi
84+
85+ echo "owner=${INFRA_REPO%%/*}" >> "$GITHUB_OUTPUT"
86+ echo "repo=${INFRA_REPO#*/}" >> "$GITHUB_OUTPUT"
87+
7588 - name : Genereer app token (Release proces app)
7689 id : app-token
77- uses : actions/create-github-app-token@v3
90+ uses : actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
7891 with :
7992 app-id : ${{ secrets.RELEASE_PROCES_APP_ID }}
8093 private-key : ${{ secrets.RELEASE_PROCES_APP_PRIVATE_KEY }}
81- repositories : don-infra
94+ owner : ${{ steps.infra-repo.outputs.owner }}
95+ repositories : ${{ steps.infra-repo.outputs.repo }}
8296
8397 - name : Checkout don-infra
84- uses : actions/checkout@v6
98+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
8599 with :
86100 repository : ${{ env.INFRA_REPO }}
87101 token : ${{ steps.app-token.outputs.token }}
88102
89103 - name : Update image tag in test overlay
90104 run : |
105+ KUSTOMIZATION_FILE="${{ env.KUSTOMIZE_PATH }}${{ env.DEPLOY_ENV }}/kustomization.yaml"
106+
91107 yq e '(.images[] | select(.name == "static")).newTag = "${{ github.sha }}"' \
92- -i ${{ env.KUSTOMIZE_PATH }}/kustomization.yaml
108+ -i "$KUSTOMIZATION_FILE"
93109
94110 - name : Commit en push naar don-infra
95111 run : |
112+ KUSTOMIZATION_FILE="${{ env.KUSTOMIZE_PATH }}${{ env.DEPLOY_ENV }}/kustomization.yaml"
113+
96114 git config user.name "${{ github.actor }}"
97115 git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
98- git add ${{ env.KUSTOMIZE_PATH }}/kustomization.yaml
116+ git add "$KUSTOMIZATION_FILE"
99117 git commit -m "test: don-site → ${{ github.sha }}
100118
101119 Branch: ${{ github.ref_name }}
0 commit comments