-
Notifications
You must be signed in to change notification settings - Fork 1
160 lines (137 loc) · 4.41 KB
/
bygg-og-deploy-master.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Bygg og deploy master
on:
push:
branches:
- 'master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_BASE: ghcr.io/${{ github.repository }}/min-side-arbeidsgiver
IMAGE: ghcr.io/${{ github.repository }}/min-side-arbeidsgiver:${{ github.sha }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Sjekk ut kode
uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: '16.14.2'
registry-url: https://npm.pkg.github.com/
cache: 'npm'
- name: Installer avhengigheter
run: npm ci --ignore-scripts --no-optional
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
bygg:
name: Bygg
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
steps:
- name: Sjekk ut kode
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: https://npm.pkg.github.com/
cache: 'npm'
- name: Installer avhengigheter
run: npm ci --production --ignore-scripts --no-optional
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- run: npm run lint
- run: npm run build
env:
PUBLIC_URL: https://cdn.nav.no/fager/min-side-arbeidsgiver/build/
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Bygg, tag og push Docker-image
run: |
docker build --tag $IMAGE --tag $IMAGE_BASE:latest .
echo $GITHUB_TOKEN | docker login docker.pkg.github.com -u $GITHUB_REPOSITORY --password-stdin
docker push $IMAGE
- id: upload
uses: navikt/frontend/actions/cdn-upload/v1@main
with:
cdn-team-name: fager
source: ./build/
destination: '/min-side-arbeidsgiver'
- name: Lag sentry release
continue-on-error: true
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
npx -p @sentry/cli sentry-cli releases new "${{ github.sha }}"
npx -p @sentry/cli sentry-cli releases files "${{ github.sha }}" upload-sourcemaps build/static/js \
--url-prefix '~/min-side-arbeidsgiver/static/js'
npx -p @sentry/cli sentry-cli releases finalize "${{ github.sha }}"
deploy-dev-gcp:
name: Deploy til dev-gcp
runs-on: ubuntu-latest
timeout-minutes: 3
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
needs: bygg
steps:
- name: Sjekk ut kode
uses: actions/checkout@v2
- name: Deploy til dev-gcp
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: nais/dev-gcp.yaml
PRINT_PAYLOAD: true
VAR: commit=${{ github.sha }}
deploy-prod-gcp:
name: Deploy til prod-gcp
runs-on: ubuntu-latest
needs: bygg
steps:
- name: Sjekk ut kode
uses: actions/checkout@v2
- name: Deploy til prod-gcp
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: nais/prod-gcp.yaml
PRINT_PAYLOAD: true
VAR: commit=${{ github.sha }}
deploy-prodlik-demo-gcp:
name: Deploy prod-lik demo
runs-on: ubuntu-latest
needs: bygg
steps:
- name: Sjekk ut kode
uses: actions/checkout@v2
- name: Deploy til labs-gcp
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: nais/labs-gcp.yaml
PRINT_PAYLOAD: true
VAR: commit=${{ github.sha }}
deploy-devlik-demo-gcp:
name: Deploy dev-lik demo
runs-on: ubuntu-latest
needs: bygg
steps:
- name: Sjekk ut kode
uses: actions/checkout@v2
- name: Deploy til labs-gcp
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: nais/experimental-labs-gcp.yaml
PRINT_PAYLOAD: true
VAR: commit=${{ github.sha }}