This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (78 loc) · 2.42 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
name: Build, push, and deploy
on:
push:
branches:
- main
- dev/*
jobs:
build-cdn-docker:
name: Build, CDN & Docker
runs-on: ubuntu-latest
permissions:
contents: 'read'
packages: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3
name: Checkout
- uses: actions/setup-node@v3
with:
node-version: '18.18.2'
cache: 'npm'
- name: 'Install dependencies'
run: 'npm ci'
- name: 'Build application'
run: 'REACT_APP_MICRO="true" REACT_APP_VERSION_HASH=${{ github.sha }} REACT_APP_BUILD_TIMESTAMP=$(date +"%Y-%m-%dT%H:%M:%S") NODE_ENV=production npm run build:cdn'
- name: cdn-upload-js
uses: navikt/frontend/actions/cdn-upload/v1@main
with:
cdn-team-name: paw
source: ./dist/js
destination: '/aia/'
- name: cdn-upload-assets
uses: navikt/frontend/actions/cdn-upload/v1@main
with:
cdn-team-name: paw
source: ./dist/assets
destination: '/aia/'
- name: docker-build-push
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: paw
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
deploy-dev:
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/dev')
name: Deploy til dev
needs: build-cdn-docker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .nais/dev.yaml
VAR: image=${{ needs.build-cdn-docker.outputs.image }}
deploy-prod:
if: github.ref == 'refs/heads/main'
name: Deploy til prod
needs: [build-cdn-docker, deploy-dev]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yaml
VAR: image=${{ needs.build-cdn-docker.outputs.image }}
VARS: .nais/vars-prod.yaml