-
Notifications
You must be signed in to change notification settings - Fork 42
110 lines (91 loc) · 3.1 KB
/
aksel-prod.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
name: Deploy aksel.nav.no
on:
push:
branches:
- main
paths:
- "aksel.nav.no/**"
env:
IMAGE: ghcr.io/navikt/aksel
jobs:
sync_data_with_sanity:
name: Update component data
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
- name: set-env for yarn install to @navikt scope
shell: bash
run: echo "NPM_AUTH_TOKEN=${{ secrets.READER_TOKEN }}" >> $GITHUB_ENV
- name: Install dependencies
run: yarn
- name: Run docgen
run: |
yarn boot
yarn docgen
- name: Create empty .env file (Can be removed when env-file-if-exists is implemented in node v22)
run: echo "" > ./aksel.nav.no/website/.env
- name: Update sanity sync
env:
SANITY_WRITE: ${{ secrets.SANITY_WRITE }}
run: yarn workspace aksel.nav.no sanity:update
build_and_deploy:
name: Build and deploy to prod-gcp
runs-on: ubuntu-latest
permissions:
packages: "write"
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
- name: set-env for yarn install to @navikt scope
shell: bash
run: echo "NPM_AUTH_TOKEN=${{ secrets.READER_TOKEN }}" >> $GITHUB_ENV
- name: add tokens to .env
run: |
echo "USE_CDN_ASSETS=true" >> aksel.nav.no/website/.env
- name: Install dependencies
run: yarn
- name: Build packages
run: yarn boot
- name: Tests
run: yarn workspace website test
- name: Create empty .env file (Can be removed when env-file-if-exists is implemented in node v22)
run: echo "" > ./aksel.nav.no/website/.env
- name: Build application
env:
SANITY_READ: ${{ secrets.SANITY_READ }}
SANITY_READ_NO_DRAFTS: ${{ secrets.SANITY_READ_NO_DRAFTS }}
run: yarn workspace aksel.nav.no build:next
- name: Upload static files to NAV CDN
uses: nais/deploy/actions/cdn-upload/v2@master
with:
team: designsystem
source: ./aksel.nav.no/website/.next/static
destination: "/website/_next"
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
- name: Get complete tag
run: echo "TAG=PROD-$( date +%s )" >> $GITHUB_ENV
- uses: nais/docker-build-push@v0
id: docker-push
with:
team: designsystem
push_image: true
dockerfile: aksel.nav.no/Dockerfile
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
- name: Deploy to prod-gcp
uses: nais/deploy/actions/deploy@master
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
RESOURCE: aksel.nav.no/nais-prod.yaml
CLUSTER: prod-gcp
IMAGE: ${{ steps.docker-push.outputs.image }}