-
Notifications
You must be signed in to change notification settings - Fork 2
143 lines (122 loc) · 3.98 KB
/
deploy-dev.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Deploy Dev Environment
on:
push:
branches:
- main
paths-ignore:
- database/**
- package.json
- package-lock.json
- CHANGELOG.md
- .conventional-changelog.mjs
- .release-it.json
env:
GITHUB_REGISTRY: ghcr.io
IMAGE_NAME_FRONTEND: bcgov/strdss-frontend
IMAGE_NAME_BACKEND: bcgov/strdss-backend
jobs:
test-backend:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.400'
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Build
run: |
pwd
dotnet build ./server/server.sln
- name: Test
run: dotnet test ./server/server.sln --no-build
build-frontend:
needs: [test-backend]
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: read
packages: write
steps:
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5
- name: Setup Tools
uses: ./.github/actions/setup-tools
- name: Render style_nonce
id: render_style_nonce
run: echo "::set-output name=style_nonce::$(echo -n ${{ github.sha }} | base64)"
- name: Build and Push
uses: egose/actions/docker-build-push@04830c07edee3c552f2c5a0330a674ff0d366c66
with:
registry-url: ${{ env.GITHUB_REGISTRY }}
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
image-name: ${{ env.IMAGE_NAME_FRONTEND }}
docker-context: frontend
docker-file: frontend/Dockerfile
docker-args: |
generate_sourcemap=true
style_nonce=${{ steps.render_style_nonce.outputs.style_nonce }}
metadata-tags: |
type=ref,event=branch
type=sha,format=long,prefix=,suffix=
build-backend:
needs: [test-backend]
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: read
packages: write
steps:
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5
- name: Setup Tools
uses: ./.github/actions/setup-tools
- name: Build and Push
uses: egose/actions/docker-build-push@04830c07edee3c552f2c5a0330a674ff0d366c66
with:
registry-url: ${{ env.GITHUB_REGISTRY }}
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
image-name: ${{ env.IMAGE_NAME_BACKEND }}
docker-context: server
docker-file: server/Dockerfile
metadata-tags: |
type=ref,event=branch
type=sha,format=long,prefix=,suffix=
deploy:
needs: [build-frontend, build-backend]
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
contents: read
environment:
name: dev
url: https://dev-strdata.apps.silver.devops.gov.bc.ca/
steps:
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5
- name: Authenticate and set context
uses: redhat-actions/oc-login@9b79eb6d8ec51bce42cb4e77f0a174fc80cf3cb9
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
namespace: f4a30d-dev
insecure_skip_tls_verify: true
- name: Deploy apps with Helm chart
run: |
make upgrade \
NAMESPACE=f4a30d-dev \
NAME=strdss-dev \
ENV_NAME=dev \
IMAGE_TAG_FRONTEND=${{ github.sha }} \
IMAGE_TAG_BACKEND=${{ github.sha }} \
working-directory: ./helm/main