-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (118 loc) · 3.54 KB
/
deploy-dev.yaml
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
name: Bygg, deploy til dev-gcp og lag release
on:
push:
paths-ignore:
- '**.md'
- '.gitignore'
- 'LICENCE'
- 'CODEOWNERS'
branches:
- main
- depfix
jobs:
test:
name: Kjør Cypress-tester
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Sjekk ut koden
uses: actions/checkout@v4
- name: Autentiser med GitHub NPM registry
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.READER_TOKEN }}" >> ~/.npmrc
echo "@navikt:registry=https://npm.pkg.github.com" >> ~/.npmrc
- name: Kjør Cypress
uses: cypress-io/github-action@v6
with:
start: npm run dev
wait-on: 'http://ip6-localhost:3001'
working-directory: client
config-file: cypress.config.js
record: false
- name: Last opp artefakt
uses: actions/upload-artifact@v4
with:
name: cypress-test
path: cypress/screenshots/
build:
name: Bygg
permissions:
packages: write
contents: write
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
docker_image: ${{ steps.docker-build-push.outputs.image }}
version_tag: ${{ steps.version-tag.outputs.VERSION_TAG}}
steps:
- name: Sjekk ut koden
uses: actions/checkout@v4
- name: Før deploy
uses: navikt/digihot-deploy/actions/pre-deploy@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bygg og push Docker image
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: teamdigihot
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
tag: ${{ env.VERSION_TAG }}
build_secrets: NODE_AUTH_TOKEN=${{ secrets.READER_TOKEN }}
- name: Definer release tag
id: version-tag
run: echo "VERSION_TAG=${{env.VERSION_TAG}}" >> "$GITHUB_OUTPUT"
deploy-labs:
name: Deploy til labs-gcp
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
id-token: write
timeout-minutes: 15
steps:
- name: Sjekk ut koden
uses: actions/checkout@v4
- name: Deploy
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/labs.yaml
IMAGE: ${{ needs.build.outputs.docker_image }}
deploy-dev:
name: Deploy til dev-gcp
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
id-token: write
timeout-minutes: 15
env:
VERSION_TAG: ${{ needs.build.outputs.version_tag }}
steps:
- name: Sjekk ut koden
uses: actions/checkout@v4
- name: Deploy
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/dev.yaml
IMAGE: ${{ needs.build.outputs.docker_image }}
- name: Etter deploy
if: github.ref == 'refs/heads/main'
uses: navikt/digihot-deploy/actions/post-deploy@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Lag release
if: github.ref == 'refs/heads/main'
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION_TAG }}
release_name: ${{ env.APPLICATION }} ${{ env.VERSION_TAG }}
body: ${{ env.CHANGE_LOG }}
draft: true
prerelease: false