-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (69 loc) · 2.31 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: "Build, push to GHCR and deploy image to GKE cluster"
on:
push:
tags: [ '*' ]
env:
RELEASE_TAG: ${{ github.ref_name }}
jobs:
build:
name: Docker build and push
if: >
${{ !github.event.deleted }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
tags: |
ghcr.io/reload/harvester:${{ env.RELEASE_TAG }}
push: true
deploy:
runs-on: ubuntu-latest
env:
GCP_PROJECT: reload-internal-alpha
GKE_CLUSTER_ZONE: europe-west1-b
steps:
# actions/checkout MUST come before auth
- uses: 'actions/checkout@v3'
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCP_CREDS }}'
# Install gcloud, `setup-gcloud` automatically picks up authentication from `auth`.
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'
# Now you can run gcloud commands authenticated as the impersonated service account.
- name: install config gcloud auth
run: |
gcloud components install gke-gcloud-auth-plugin
gcloud container clusters get-credentials ${{ env.GCP_PROJECT }}-cluster --region ${{ env.GKE_CLUSTER_ZONE }} --project ${{ env.GCP_PROJECT }}
- name: Install Helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
- name: Deploy helm chart to cluster
run: |
helm upgrade harvester ./helm-chart/harvester \
--atomic \
--cleanup-on-fail \
--install \
--namespace harvester \
--create-namespace \
--set harvester.harvest.secret='${{ secrets.HARVEST_SECRET }}' \
--set imageTag=${{ env.RELEASE_TAG }}
needs: build