-
Notifications
You must be signed in to change notification settings - Fork 4
156 lines (147 loc) · 4.59 KB
/
deploy.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
name: deploy
on:
push:
branches:
- master
- next/**
env:
APP: speil
TEAM: tbd
jobs:
test-and-lint:
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-npm-deps
with:
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- run: npm run test
- run: npm run lint
build-dev:
if: "!startsWith(github.ref, 'refs/heads/next/')"
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-npm-deps
name: Installer deps
with:
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- run: cp envs/.env.dev .env.production
- run: npm run build
- uses: ./.github/actions/cdn-n-image
name: Last opp til CDN og bygg docker image
id: cdn-n-image
with:
app: ${{ env.APP }}
team: ${{ env.TEAM }}
env: dev
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
outputs:
image: ${{ steps.cdn-n-image.outputs.image }}
build-experimental-dev:
if: startsWith(github.ref, 'refs/heads/next/')
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-npm-deps
name: Installer deps
with:
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- run: cp envs/.env.dev .env.production
- run: npm run build
- uses: ./.github/actions/cdn-n-image
name: Last opp til CDN og bygg docker image
id: cdn-n-image
with:
app: ${{ env.APP }}
team: ${{ env.TEAM }}
env: next
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
outputs:
image: ${{ steps.cdn-n-image.outputs.image }}
build-production:
if: github.ref == 'refs/heads/master'
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-npm-deps
name: Installer deps
with:
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- run: cp envs/.env.production .env.production
- run: npm run build
- uses: ./.github/actions/cdn-n-image
name: Last opp til CDN og bygg docker image
id: cdn-n-image
with:
app: ${{ env.APP }}
team: ${{ env.TEAM }}
env: prod
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
outputs:
image: ${{ steps.cdn-n-image.outputs.image }}
deploy-dev:
name: Deploy to dev
needs: [build-dev, test-and-lint]
runs-on: ubuntu-latest
environment:
name: dev
url: https://speil.ansatt.dev.nav.no
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: deploy/dev.yml,deploy/alerts-dev.yml
VAR: 'image=${{ needs.build-dev.outputs.image }},team=${{env.TEAM}},app=${{env.APP}}'
deploy-experimental-dev:
name: Deploy to experimental dev
needs: [build-experimental-dev, test-and-lint]
runs-on: ubuntu-latest
environment:
name: dev-next
url: https://speil-next.intern.dev.nav.no
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: deploy/next.yml
VAR: 'image=${{ needs.build-experimental-dev.outputs.image }},team=${{env.TEAM}},app=${{env.APP}}-next'
deploy-prod:
name: Deploy to prod
needs: [build-production, test-and-lint]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
environment:
name: production
url: https://speil.intern.nav.no
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: deploy/prod.yml,deploy/alerts-prod.yml
VAR: 'image=${{ needs.build-production.outputs.image }},team=${{env.TEAM}},app=${{env.APP}}'