1- name : Build , deploy to dev-gcp
1+ name : Bygg , deploy til dev-gcp og lag release
22on :
33 push :
44 paths-ignore :
55 - ' **.md'
66 - ' .gitignore'
77 - ' LICENCE'
88 - ' CODEOWNERS'
9- - ' docs/**'
10- - ' docs'
11- - ' docs/'
12- - ' /docs'
139 branches :
14- - main_
15-
16- env :
17- IMAGE : ' ghcr.io/navikt/hm-brilleavtale-frontend:${{ github.sha }}'
10+ - main
1811
1912jobs :
20-
2113 build :
14+ name : Bygg
2215 runs-on : ubuntu-latest
2316 permissions :
2417 contents : " write"
2518 id-token : " write"
2619 packages : " write"
2720 timeout-minutes : 15
21+ outputs :
22+ docker_image : ${{ steps.docker-build-push.outputs.image }}
23+ version_tag : ${{ steps.version-tag.outputs.VERSION_TAG}}
24+
2825 steps :
2926 - name : Checkout code
30- uses : actions/checkout@v3
27+ uses : actions/checkout@v4
28+
3129 - name : pre-deploy
32- uses : navikt/digihot-deploy/actions/pre-deploy@v2
30+ uses : navikt/digihot-deploy/actions/pre-deploy@v3
3331 env :
3432 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35- DOCKER_IMAGE : ghcr.io/navikt/hm-brilleavtale-frontend
36- - name : Set up Docker Buildx
37- uses : docker/setup-buildx-action@v2
3833
39- - name : Login to GitHub Package Repository
40- uses : docker/login-action@v2
34+ - name : Bygg og push Docker image
35+ uses : nais/docker-build-push@v0
36+ id : docker-build-push
4137 with :
42- registry : ghcr.io
43- username : ${{ github.repository_owner }}
44- password : ${{ secrets.GITHUB_TOKEN }}
38+ team : teamdigihot
39+ identity_provider : ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
40+ project_id : ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
41+ tag : ${{ env.VERSION_TAG }}
42+ build_secrets : NODE_AUTH_TOKEN=${{ secrets.READER_TOKEN }}
4543
46- - name : Set up .npmrc to use in Docker build
47- uses : actions/setup-node@v3
48- with :
49- registry-url : " https://npm.pkg.github.com"
44+ - name : Definer release tag
45+ id : version-tag
46+ run : echo "VERSION_TAG=${{env.VERSION_TAG}}" >> "$GITHUB_OUTPUT"
47+
48+ deploy-labs :
49+ name : Deploy til labs-gcp
50+ runs-on : ubuntu-latest
51+ needs : [build]
52+ permissions :
53+ contents : write
54+ id-token : write
55+ timeout-minutes : 15
5056
51- - run : cp $NPM_CONFIG_USERCONFIG .npmrc
57+ steps :
58+ - name : Sjekk ut koden
59+ uses : actions/checkout@v4
5260
53- - name : Build and push
54- uses : docker/build-push-action@v4
55- with :
56- context : .
57- tags : ${{ env.IMAGE }}
58- push : true
59- cache-from : type=gha
60- cache-to : type=gha,mode=max
61- secrets : |
62- "NODE_AUTH_TOKEN=${{ secrets.READER_TOKEN }}"
63- - name : deploy to dev
64- uses : nais/deploy/actions/deploy@v1
61+ - name : Deploy
62+ uses : nais/deploy/actions/deploy@v2
63+ env :
64+ CLUSTER : dev-gcp
65+ RESOURCE : .nais/labs.yml
66+ IMAGE : ${{ needs.build.outputs.docker_image }}
67+
68+ deploy-dev :
69+ name : Deploy til dev-gcp
70+ runs-on : ubuntu-latest
71+ needs : [ build ]
72+ permissions :
73+ contents : write
74+ id-token : write
75+ timeout-minutes : 15
76+ env :
77+ VERSION_TAG : ${{ needs.build.outputs.version_tag }}
78+
79+ steps :
80+ - name : Sjekk ut koden
81+ uses : actions/checkout@v4
82+
83+ - name : Deploy
84+ uses : nais/deploy/actions/deploy@v2
6585 env :
66- APIKEY : ${{ secrets.NAIS_DEPLOY_APIKEY }}
6786 CLUSTER : dev-gcp
6887 RESOURCE : .nais/dev.yml
69- VAR : image=${{ env.IMAGE }},commit=${{ github.sha }}
70- - name : post-deploy
88+ IMAGE : ${{ needs.build.outputs.docker_image }}
89+
90+ - name : Etter deploy
7191 if : github.ref == 'refs/heads/main'
72- uses : navikt/digihot-deploy/actions/post-deploy@v2
92+ uses : navikt/digihot-deploy/actions/post-deploy@v3
7393 env :
7494 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75- - name : draft release
95+
96+ - name : Lag release
7697 if : github.ref == 'refs/heads/main'
7798 uses : actions/create-release@latest
7899 env :
@@ -82,12 +103,4 @@ jobs:
82103 release_name : ${{ env.APPLICATION }} ${{ env.VERSION_TAG }}
83104 body : ${{ env.CHANGE_LOG }}
84105 draft : true
85- prerelease : false
86- - name : deploy to labs
87- uses : nais/deploy/actions/deploy@v1
88- env :
89- APIKEY : ${{ secrets.NAIS_DEPLOY_APIKEY }}
90- CLUSTER : dev-gcp
91- RESOURCE : .nais/labs.yml
92- VAR : image=${{ env.IMAGE }},commit=${{ github.sha }}
93-
106+ prerelease : false
0 commit comments