This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.75 KB
/
deploy.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
name: Deploy on Google Cloud Platform
on:
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# - name: Run Lint
# uses: golangci/golangci-lint-action@v3
deploy:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Authenticate Docker
run: |
gcloud auth configure-docker --quiet us-central1-docker.pkg.dev
- name: Deploy to Cloud Run
run: |
# docker buildx build -t play .
# gcloud config set run/region ${{ secrets.REGION }}
# gcloud config set builds/use_kaniko True
# gcloud config set app/cloud_build_timeout 900
# gcloud run deploy ${{ secrets.SERVICE_NAME }} --source $(pwd) --platform managed --allow-unauthenticated
# gcloud run services update-traffic ${{ secrets.SERVICE_NAME }} --to-latest
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.REGISTRY }}/${{ secrets.SERVICE_NAME }}:latest
cache-from: type=registry,ref=${{ secrets.REGISTRY }}/${{ secrets.SERVICE_NAME }}:buildcache
cache-to: type=registry,ref=${{ secrets.REGISTRY }}/${{ secrets.SERVICE_NAME }}:buildcache,mode=max