generated from KakinokiKanta/go-dev-template
-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (37 loc) · 1.13 KB
/
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
name: Deploy to Google Cloud Run
on:
push:
branches:
- main
# 下記は適宜書き換えてください
env:
GCP_PROJECT_ID: tacktail
GCP_REGION: asia-northeast1
IMAGE_NAME: gcr.io/tacktail/tacktail-backend
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Authenticate with Google Cloud
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Configure Docker
run: gcloud auth configure-docker
- name: Build and push Docker image
run: |
TAG=$(echo $GITHUB_SHA | head -c7)
docker build -t ${IMAGE_NAME}:${TAG} .
docker push ${IMAGE_NAME}:${TAG}
- name: Deploy to Cloud Run
run: |
TAG=$(echo $GITHUB_SHA | head -c7)
gcloud run deploy tacktail-backend \
--image ${IMAGE_NAME}:${TAG} \
--platform managed \
--region ${GCP_REGION} \
--allow-unauthenticated