-
Notifications
You must be signed in to change notification settings - Fork 5
94 lines (77 loc) · 2.39 KB
/
dev-webapp-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
91
92
93
94
name: Dev Webapp Deploy
on:
push:
branches:
- dev
paths:
- "webapp/**"
- "Dockerfile"
- "deploy/**"
- "web-kubernetes/**"
- ".github/workflows/dev-webapp-deploy.yml"
- "templates/**"
- "src/**"
- "static/**"
- "requirements.txt"
# Environment variables available to all jobs and steps in this workflow
env:
GITHUB_SHA: ${{ github.sha }}
GKE_PROJECT: ${{ secrets.DEV_GKE_PROJECT }}
GKE_EMAIL: ${{ secrets.DEV_GKE_EMAIL }}
GKE_ZONE: us-central1-c
GKE_CLUSTER: cluster-1
REGISTRY_HOSTNAME: gcr.io
PROJECT: ${{ secrets.DEV_GKE_PROJECT }}
HOST: dev.compute.studio
TAG: ${{ github.sha }}
CS_CONFIG: ${{ secrets.DEV_CS_CONFIG }}
jobs:
setup-build-publish-deploy:
name: Setup, Build, Test, Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.8"
- uses: actions/setup-node@v1
with:
node-version: '12'
- name: Install yarn
run: npm install yarn
- name: Create app bundle
run: yarn install && yarn build
# Install pip and pytest
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ./secrets
python -m pip install -e ./workers
python -m pip install -e ./deploy
# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@master
with:
service_account_email: $GKE_EMAIL
service_account_key: ${{ secrets.DEV_GOOGLE_APPLICATION_CREDENTIALS }}
export_default_credentials: true
# Configure docker to use the gcloud command-line tool as a credential helper
- run: |
# Set up docker to authenticate
gcloud auth configure-docker
- name: Set cs-config.yaml file.
run: |
echo $CS_CONFIG | base64 --decode > cs-config.yaml
- name: Build Docker Images
run: |
cs webapp build
- name: Push Docker Images
run: |
cs webapp push
# Apply updates to cluster
- name: Deploy
run: |
gcloud container clusters get-credentials $GKE_CLUSTER --zone $GKE_ZONE --project $GKE_PROJECT
cs webapp config -o - | kubectl apply -f -
kubectl get pods -o wide