-
-
Notifications
You must be signed in to change notification settings - Fork 68
59 lines (54 loc) · 1.85 KB
/
cd.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
name: CD
on:
workflow_dispatch: ~
push:
branches:
- main
- staging
# Deploy if "deploy" label exists
pull_request:
types: [ reopened, synchronize, labeled ]
# Do not use concurrency to prevent simultaneous helm deployments
jobs:
remove-deploy-label:
name: Remove deploy label
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy')
runs-on: ubuntu-latest
steps:
- uses: mondeja/remove-labels-gh-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
deploy
build:
name: Build
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy'))
uses: ./.github/workflows/build.yml
with:
tags: |
type=ref,event=pr,prefix=pr-,priority=1000
type=edge,branch=$repo.default_branch,priority=900
type=raw,value=latest,enable={{is_default_branch}},priority=900
push: true
gke-cluster: api-platform-demo
gke-zone: europe-west1-c
secrets:
gke-credentials: ${{ secrets.GKE_SA_KEY }}
gke-project: ${{ secrets.GKE_PROJECT }}
gh-key: ${{ secrets.GH_KEY }}
deploy:
name: Deploy
needs: [ build ]
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy'))
uses: ./.github/workflows/deploy.yml
with:
environment: prod
docker-images-version: ${{ github.sha }}
gke-cluster: api-platform-demo
gke-zone: europe-west1-c
secrets:
gke-credentials: ${{ secrets.GKE_SA_KEY }}
gke-project: ${{ secrets.GKE_PROJECT }}
gh-key: ${{ secrets.GH_KEY }}
# cloudflare-api-token: ${{ secrets.CF_API_TOKEN }}
# cloudflare-zone-id: ${{ secrets.CF_ZONE_ID }}