-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 2 KB
/
main.yaml
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
name: Google Cloud Run Revision Deploy
on:
pull_request:
push:
branches:
- main
# Kill the workflow if the PR is updated with a new commit
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-deploy:
name: Build and Deploy to Cloud Run
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
deployments: 'write'
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Get Environment
id: environment
run: |
if [ "${{ github.ref_name }}" = "main" ]; then
echo "::set-output name=name::production"
else
echo "::set-output name=name::development"
fi
- name: Create GitHub deployment
uses: chrnorm/deployment-action@v2
id: deployment
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: ${{ steps.environment.outputs.name }}
initial-status: in_progress
- name: Deploy to Cloud Run
uses: dmsi-io/gha-cloudrun-deploy@v1
id: deploy
with:
GCP_IDENTITY_PROVIDER: ${{ secrets.GCP_IDENTITY_PROVIDER }}
GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment-url: ${{ steps.deploy.outputs.url }}
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
state: 'success'
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment-url: ${{ steps.deploy.outputs.url }}
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
state: 'failure'