-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (62 loc) · 1.95 KB
/
build_n_deploy_prod.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
name: Build&deploy to prod
on:
workflow_dispatch:
push:
branches:
- main
env:
IMAGE: ghcr.io/navikt/familie-tilbake-frontend:${{ github.sha }}
IMAGE_LATEST: ghcr.io/navikt/familie-tilbake-frontend:latest
VERSION: familie-tilbake-frontend:${{ github.sha }}
jobs:
build:
name: Build and push Docker container
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: npm
registry-url: "https://npm.pkg.github.com"
- uses: ./.github/yarn-cache
- name: Login to GitHub Container Registry
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish Docker image
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_RELEASE: ${{ github.sha }}
run: |
yarn
yarn build
yarn test
docker build . -t ${IMAGE} -t ${IMAGE_LATEST}
docker push ${IMAGE}
docker push ${IMAGE_LATEST}
deploy:
name: Deploy to NAIS / GCP
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy til dev-gcp
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: build_n_deploy/naiserator/naiserator_dev_gcp.yaml
VAR: VERSION=${{ env.VERSION }}
- name: Deploy til prod-gcp
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: build_n_deploy/naiserator/naiserator_prod_gcp.yaml
VAR: VERSION=${{ env.VERSION }}