4
4
workflow_dispatch :
5
5
push :
6
6
7
- env :
8
- IMAGE : ghcr.io/${{ github.repository }}/dp-faktasider-frontend:${{ github.sha }}
9
- LATEST_IMAGE : ghcr.io/${{ github.repository }}/dp-faktasider-frontend:latest
10
-
11
7
jobs :
12
8
jest-test :
13
9
name : Jest tests
14
10
runs-on : ubuntu-latest
15
11
steps :
16
- - uses : actions/checkout@v3
17
- - uses : actions/setup-node@v3
12
+ - uses : actions/checkout@v4
13
+ - uses : actions/setup-node@v4
18
14
with :
19
15
node-version : ' lts/*'
20
16
cache : " npm"
@@ -36,24 +32,14 @@ jobs:
36
32
install :
37
33
runs-on : ubuntu-latest
38
34
steps :
39
- - uses : actions/checkout@v3
40
-
41
- - name : Cache node_modules
42
- uses : actions/cache@v3
43
- id : node_modules
44
- with :
45
- path : ./node_modules
46
- key : modules-${{ hashFiles('package-lock.json') }}
47
-
48
- - uses : actions/setup-node@v3
49
- if : steps.node_modules.outputs.cache-hit != 'true'
35
+ - uses : actions/checkout@v4
36
+ - uses : actions/setup-node@v4
50
37
with :
51
38
node-version : ' lts/*'
52
39
cache : " npm"
53
40
registry-url : " https://npm.pkg.github.com"
54
41
55
42
- run : npm ci --ignore-scripts
56
- if : steps.node_modules.outputs.cache-hit != 'true'
57
43
env :
58
44
NODE_AUTH_TOKEN : ${{ secrets.READER_TOKEN }}
59
45
@@ -63,63 +49,47 @@ jobs:
63
49
permissions :
64
50
packages : write
65
51
steps :
66
- - uses : actions/checkout@v3
67
- - uses : actions/setup-node@v3
52
+ - uses : actions/checkout@v4
53
+ - uses : actions/setup-node@v4
68
54
with :
69
55
node-version : " lts/*"
56
+ cache : npm
70
57
71
- - name : Cache node_modules
72
- uses : actions/cache@v3
73
- with :
74
- path : ./node_modules
75
- key : modules-${{ hashFiles('package-lock.json') }}
76
-
77
- - name : Cache .next/cache
78
- uses : actions/cache@v3
79
- with :
80
- path : ./.next/cache
81
- # Generate a new cache whenever packages or source files change.
82
- key : ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
83
- # If source files changed but packages didn't, rebuild from a prior cache.
84
- restore-keys : |
85
- ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
86
58
- run : npm run build
87
59
88
60
# Bygg docker image
89
- - uses : docker/setup-buildx-action@v2
90
- - uses : docker/login-action@v1
61
+ - name : docker-build-push
62
+ uses : nais/docker-build-push@v0
63
+ id : docker-build-push
91
64
with :
92
- registry : ghcr.io
93
- username : ${{ github.repository_owner }}
94
- password : ${{ secrets.GITHUB_TOKEN }}
95
-
96
- - uses : docker/build-push-action@v3
97
- with :
98
- context : .
99
- push : true
100
- pull : true
101
- tags : ${{ env.IMAGE }},${{ env.LATEST_IMAGE }}
102
- cache-from : type=gha
103
- cache-to : type=gha,mode=max
65
+ team : teamdagpenger
66
+ tag : ${{ github.sha }}
67
+ identity_provider : ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
68
+ project_id : ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
69
+ salsa : false
104
70
105
71
- name : Cache static files
106
- uses : actions/cache@v3
72
+ uses : actions/cache@v4
107
73
with :
108
74
path : ./.next/static
109
75
key : ${{ github.sha }}
110
76
77
+ outputs :
78
+ image : ${{ steps.docker-build-push.outputs.image }}
79
+ digest : ${{ steps.docker-build-push.outputs.digest }}
80
+
111
81
deploy-dev-gcp :
112
82
name : Deploy to dev gcp
113
- needs : [build, jest-test]
83
+ needs : [ build, jest-test ]
114
84
runs-on : ubuntu-latest
115
85
steps :
116
- - uses : actions/checkout@v3
117
- - uses : nais/deploy/actions/deploy@v1
86
+ - uses : actions/checkout@v4
87
+ - uses : nais/deploy/actions/deploy@v2
118
88
env :
119
- APIKEY : ${{ secrets.NAIS_DEPLOY_APIKEY }}
120
89
CLUSTER : dev-gcp
121
90
RESOURCE : nais/nais.yaml
122
91
VARS : nais/dev-gcp/vars.yaml
92
+ VAR : image=${{ needs.build.outputs.image }}
123
93
PRINT_PAYLOAD : true
124
94
125
95
- name : Lag deployment i Sentry
@@ -137,17 +107,17 @@ jobs:
137
107
138
108
deploy-prod-gcp :
139
109
name : Deploy to prod gcp
140
- needs : [deploy-dev-gcp]
110
+ needs : [ build, deploy-dev-gcp ]
141
111
if : github.ref == 'refs/heads/main'
142
112
runs-on : ubuntu-latest
143
113
steps :
144
- - uses : actions/checkout@v3
145
- - uses : nais/deploy/actions/deploy@v1
114
+ - uses : actions/checkout@v4
115
+ - uses : nais/deploy/actions/deploy@v2
146
116
env :
147
- APIKEY : ${{ secrets.NAIS_DEPLOY_APIKEY }}
148
117
CLUSTER : prod-gcp
149
118
RESOURCE : nais/nais.yaml
150
119
VARS : nais/prod-gcp/vars.yaml
120
+ VAR : image=${{ needs.build.outputs.image }}
151
121
PRINT_PAYLOAD : true
152
122
153
123
- name : Lag deployment i Sentry
0 commit comments