This repository has been archived by the owner on Jun 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
83 lines (69 loc) · 2.29 KB
/
action.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: 'Build and Deploy Cloud Run Revision'
description: 'Build a Docker Image and Deploy a new Cloud Run Revision'
branding:
icon: upload-cloud
color: green
inputs:
project-id:
description: 'GCP Project ID'
required: true
image-name:
description: 'Name of the Image'
required: true
service-account:
description: 'Service Account for using cloud build and deploying to cloud run'
required: true
dockerfile-path:
description: 'Path of the dockerfile to use'
required: false
default: dockerfile
build-arg:
description: 'Build Arguments to pass to docker during build. This is only required if your dockerfile uses `ARG` to take build arguments'
required: false
tag:
description: 'Tag for the Cloud Run Revision'
required: false
region:
description: 'Region to deploy the Cloud Run Revision to'
required: false
env-vars:
description: 'Enviorment Variables for the revision'
required: false
credentials:
description: 'Credentials for the revision'
required: false
outputs:
url:
description: The URL of your Cloud Run service revision
value: ${{ steps.deploy.outputs.url }}
runs:
using: "composite"
steps:
- name: Setup GCloud
uses: google-github-actions/[email protected]
with:
project_id: ${{ inputs.project-id }}
service_account_key: ${{ inputs.service-account }}
export_default_credentials: true
- name: Configure Docker
run: |
gcloud auth configure-docker --quiet
shell: bash
- name: Build Image
run: |
docker build . -f ${{ inputs.dockerfile-path }} -t gcr.io/${{ inputs.project-id }}/${{ inputs.image-name }} --build-arg=${{ inputs.build-arg }}
shell: bash
- name: Push Image to Google Cloud Image Registry
run: |
docker push gcr.io/${{ inputs.project-id }}/${{ inputs.image-name }}
shell: bash
- name: Deploy New Revision to Cloud Run
id: deploy
uses: google-github-actions/[email protected]
with:
service: ${{ inputs.image-name }}
image: gcr.io/${{ inputs.project-id }}/${{ inputs.image-name }}:latest
tag: ${{ inputs.tag }}
region: ${{ inputs.region }}
env_vars: ${{ inputs.env_vars }}
credentials: ${{ inputs.credentials }}