mirror of
https://github.com/harry0703/MoneyPrinterTurbo.git
synced 2026-02-22 00:47:22 +08:00
40 lines
1.0 KiB
YAML
40 lines
1.0 KiB
YAML
name: Build and Deploy the API to Cloud Run
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Log in to Google Cloud
|
|
uses: google-github-actions/auth@v1
|
|
with:
|
|
credentials_json: ${{ secrets.GCP_SA_KEY }}
|
|
|
|
- name: Configure Docker for Google Cloud
|
|
run: gcloud auth configure-docker
|
|
|
|
- name: Build Docker image
|
|
run: docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/moneyprinterturbo:$GITHUB_SHA .
|
|
|
|
- name: Push Docker image
|
|
run: docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/moneyprinterturbo:$GITHUB_SHA
|
|
|
|
- name: Deploy to Cloud Run
|
|
run: |
|
|
gcloud run deploy moneyprinterturbo \
|
|
--image gcr.io/${{ secrets.GCP_PROJECT_ID }}/moneyprinterturbo:$GITHUB_SHA \
|
|
--platform managed \
|
|
--region ${{ secrets.GCP_REGION }} \
|
|
--allow-unauthenticated |