Skip to content

Commit b0faf9f

Browse files
committed
chore: update GitHub Actions workflows to use dynamic repository names and latest action versions [deploy-test]
1 parent 2c32fcc commit b0faf9f

File tree

5 files changed

+70
-35
lines changed

5 files changed

+70
-35
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ on:
1111
default: "main"
1212

1313
env:
14-
IMAGE_NAME: ghcr.io/developer-overheid-nl/don-site
14+
IMAGE_NAME: ghcr.io/${{ github.repository }}
1515

1616
jobs:
1717
build:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v4
21+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
2222

2323
- name: Build image
24-
uses: docker/build-push-action@v7
24+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294
2525
with:
2626
target: caddy
2727
tags: |
@@ -33,21 +33,20 @@ jobs:
3333
"PIWIK_PRO_SITE_ID=${{ secrets.PIWIK_PRO_SITE_ID }}"
3434
3535
- name: Upload artifact
36-
uses: actions/upload-artifact@v7
36+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
3737
with:
3838
name: image
3939
path: ${{ runner.temp }}/image.tar
4040
retention-days: 1
4141

4242
publish:
4343
if: |
44-
github.repository == 'developer-overheid-nl/don-site' &&
45-
(github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch')
44+
github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
4645
runs-on: ubuntu-latest
4746
needs: build
4847
steps:
4948
- name: Download artifact
50-
uses: actions/download-artifact@v8
49+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
5150
with:
5251
name: image
5352
path: ${{ runner.temp }}
@@ -57,7 +56,7 @@ jobs:
5756
docker load --input ${{ runner.temp }}/image.tar
5857
5958
- name: Login to container registry
60-
uses: docker/login-action@v4
59+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2
6160
with:
6261
registry: ghcr.io
6362
username: ${{ github.actor }}

.github/workflows/check-links.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
check-links:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v6
11+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
1212

1313
- name: Install pnpm
1414
run: npm install -g pnpm
@@ -20,7 +20,7 @@ jobs:
2020
run: pnpm run build
2121

2222
- name: Run Linkinator to check external links
23-
uses: JustinBeckwith/linkinator-action@v2.4.0
23+
uses: JustinBeckwith/linkinator-action@f62ba0c110a76effb2ee6022cc6ce4ab161085e3
2424
continue-on-error: true
2525
with:
2626
paths: "build"

.github/workflows/check-wcag.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
check-wcag:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v6
12+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
1313

1414
- name: Install pnpm
1515
run: npm install -g pnpm
@@ -30,7 +30,7 @@ jobs:
3030

3131
- name: Upload WCAG report to Slack
3232
if: always()
33-
uses: slackapi/slack-github-action@v3.0.1
33+
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95
3434
with:
3535
method: files.uploadV2
3636
token: ${{ secrets.SLACK_BOT_TOKEN }}

.github/workflows/deploy-prod.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,39 @@ on:
77
- main
88

99
env:
10-
IMAGE_NAME: ghcr.io/developer-overheid-nl/don-site
11-
INFRA_REPO: developer-overheid-nl/don-infra
12-
KUSTOMIZE_PATH: apps/frontend/overlays/prod
10+
IMAGE_NAME: ghcr.io/${{ github.repository }}
11+
INFRA_REPO: ${{ vars.INFRA_REPO }}
12+
KUSTOMIZE_PATH: ${{ vars.KUSTOMIZE_PATH }}
13+
DEPLOY_ENV: prod
1314

1415
jobs:
1516
create-infra-pr:
16-
if: github.repository == 'developer-overheid-nl/don-site'
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Parse infra repository
20+
id: infra-repo
21+
run: |
22+
INFRA_REPO="${{ env.INFRA_REPO }}"
23+
24+
if [[ -z "$INFRA_REPO" || "$INFRA_REPO" != */* ]]; then
25+
echo "INFRA_REPO moet de vorm owner/repo hebben, huidige waarde: '$INFRA_REPO'" >&2
26+
exit 1
27+
fi
28+
29+
echo "owner=${INFRA_REPO%%/*}" >> "$GITHUB_OUTPUT"
30+
echo "repo=${INFRA_REPO#*/}" >> "$GITHUB_OUTPUT"
31+
1932
- name: Genereer app token (Release proces app)
2033
id: app-token
21-
uses: actions/create-github-app-token@v3
34+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
2235
with:
2336
app-id: ${{ secrets.RELEASE_PROCES_APP_ID }}
2437
private-key: ${{ secrets.RELEASE_PROCES_APP_PRIVATE_KEY }}
25-
repositories: don-infra
38+
owner: ${{ steps.infra-repo.outputs.owner }}
39+
repositories: ${{ steps.infra-repo.outputs.repo }}
2640

2741
- name: Checkout don-infra
28-
uses: actions/checkout@v6
42+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
2943
with:
3044
repository: ${{ env.INFRA_REPO }}
3145
token: ${{ steps.app-token.outputs.token }}
@@ -39,14 +53,18 @@ jobs:
3953
4054
- name: Update image tag in prod overlay
4155
run: |
56+
KUSTOMIZATION_FILE="${{ env.KUSTOMIZE_PATH }}${{ env.DEPLOY_ENV }}/kustomization.yaml"
57+
4258
yq e '(.images[] | select(.name == "static")).newTag = "${{ github.sha }}"' \
43-
-i ${{ env.KUSTOMIZE_PATH }}/kustomization.yaml
59+
-i "$KUSTOMIZATION_FILE"
4460
4561
- name: Commit en push release branch
4662
run: |
63+
KUSTOMIZATION_FILE="${{ env.KUSTOMIZE_PATH }}${{ env.DEPLOY_ENV }}/kustomization.yaml"
64+
4765
git config user.name "${{ github.actor }}"
4866
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
49-
git add ${{ env.KUSTOMIZE_PATH }}/kustomization.yaml
67+
git add "$KUSTOMIZATION_FILE"
5068
git commit -m "release: don-site → ${{ github.sha }}
5169
5270
Commit: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"

.github/workflows/deploy-test.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ on:
77
- main
88

99
env:
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

1415
jobs:
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

Comments
 (0)