-
Notifications
You must be signed in to change notification settings - Fork 9
82 lines (72 loc) · 2.14 KB
/
deploy-frackend.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
name: 'deploy: frackend'
on:
push:
branches:
- 'main'
paths:
- '.github/workflows/deploy-frackend.yaml'
- 'apps/frackend/**'
- 'apps/frontend/**'
workflow_dispatch:
env:
IMAGE: ghcr.io/${{ github.repository }}/teamfrackend:${{ github.sha }}
jobs:
build:
name: Build and push docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: apps/frackend/package-lock.json
- name: Install frontend
working-directory: apps/frontend
run: npm install
- name: add version to frontend
env:
GITHUB_SHA: ${{ github.sha }}
working-directory: apps/frontend
run: echo "VITE_APP_GIT_VERSION=${GITHUB_SHA}" >> .env
- name: Build frontend
working-directory: apps/frontend
run: npm run build
- name: Copy frontend dist into public directory of frackend
working-directory: apps/frontend
run: cp -r dist/ ../frackend/public
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker container
uses: docker/build-push-action@v3
with:
context: apps/frackend
push: true
tags: ${{ env.IMAGE }}
deploy-dev:
name: Deploy dev-gcp
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_ORG_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: apps/frackend/nais/frackend-dev.yaml
deploy-prod:
name: Deploy prod-gcp
needs: deploy-dev
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_ORG_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: apps/frackend/nais/frackend-prod.yaml