generated from concise-ee/j6uluh2kk
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (54 loc) · 1.81 KB
/
build_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
name: Build and Deploy
on:
push:
branches:
- '**'
jobs:
build:
name: Build image
runs-on: ubuntu-latest
env:
PROJECT_ID: j6uluh2kk
REPO: ${{ github.event.repository.name }}
TEAM: team-3
steps:
- name: Checkout
uses: actions/checkout@v2
- id: auth
uses: google-github-actions/auth@v0.4.0
with:
credentials_json: ${{ secrets.GCR_J6ULUH2KK_SERVICE_ACCOUNT_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0.2.1
with:
export_default_credentials: true
- name: Use gcloud CLI
run: gcloud info
# Build docker image
- name: Image
run: |-
docker build --tag eu.gcr.io/$PROJECT_ID/$REPO:$GITHUB_SHA .
# Configure docker to use the gcloud command-line tool as a credential helper
- run: |
gcloud auth configure-docker -q
# Push image to Google Container Registry
- name: Push
run: |-
docker push eu.gcr.io/$PROJECT_ID/$REPO:$GITHUB_SHA
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@fb08709ba27618c31c09e014e1d8364b02e5042e
with:
cluster_name: ${{ env.PROJECT_ID }}
location: europe-west1
credentials: ${{ secrets.GCR_J6ULUH2KK_SERVICE_ACCOUNT_KEY }}
- name: Set correct params
run: |
sed -ie "s/IMAGE/$REPO:$GITHUB_SHA/g" k8s/deployment.yml
sed -ie "s/NAME/$TEAM/g" k8s/deployment.yml
sed -ie "s/NAME/$TEAM/g" k8s/namespace.yml
sed -ie "s/NAME/$TEAM/g" k8s/service.yml
- name: Deploy
run: |-
kubectl apply -f k8s/namespace.yml
kubectl apply -f k8s/service.yml
kubectl apply -f k8s/deployment.yml