-
Notifications
You must be signed in to change notification settings - Fork 5
73 lines (57 loc) · 2.5 KB
/
client_adr_push.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
# This is a basic workflow to help you get started with Actions
name: CLIENT_ADR_PUSH
# Controls when the workflow will run
on:
push:
branches:
- main
paths:
- ".github/workflows/client_adr_push.yml"
- "client/**"
- "config/client/**"
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# deployment
client_deployment:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
REACT_APP_CLIENT_TOKEN: ${{ secrets.CLIENT_TOKEN }}
REACT_APP_COMBAT_API_URL: "https://bff.apps.7cav.us/roster/combat"
REACT_APP_RESERVE_API_URL: "https://bff.apps.7cav.us/roster/reserves"
REACT_APP_CACHE_TIMESTAMP_URL: "https://bff.apps.7cav.us/cache-timestamp"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout the Repo
uses: actions/checkout@v3
- name: Setup node.js
uses: actions/setup-node@v3
- name: Install Dependancies
run: npm i
working-directory: client
- name: Update Browserlist
run: npx browserslist@latest --update-db
working-directory: client
- name: Build Client to Prod
run: npm run build
working-directory: client
- name: Build client Image
run: docker build --file ./client/Dockerfile --tag registry.digitalocean.com/s6containers/adr_client:$(echo $GITHUB_SHA | head -c7) .
- name: Instal doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Push image to DO Container Registry
run: docker push registry.digitalocean.com/s6containers/adr_client:$(echo $GITHUB_SHA | head -c7)
- name: Update Deployment File
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|registry.digitalocean.com/s6containers/adr_client:'${TAG}'|' $GITHUB_WORKSPACE/config/client/deployment.yml
- name: Save DO Kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 cav-kube
- name: Deploy to DO Cluster
run: kubectl apply -f $GITHUB_WORKSPACE/config/client/deployment.yml
- name: Verify Deployment
run: kubectl rollout status deployment/adr-client -n 7cav