mirror of
https://github.com/harry0703/MoneyPrinterTurbo.git
synced 2026-02-23 09:27:21 +08:00
54 lines
1.7 KiB
YAML
54 lines
1.7 KiB
YAML
name: Build and Deploy 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 for webui
|
|
run: docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/moneyprinterturbo-webui:$GITHUB_SHA -f Dockerfile .
|
|
|
|
- name: Push Docker image for webui
|
|
run: docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/moneyprinterturbo-webui:$GITHUB_SHA
|
|
|
|
- name: Build Docker image for api
|
|
run: docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/moneyprinterturbo-api:$GITHUB_SHA -f Dockerfile .
|
|
|
|
- name: Push Docker image for api
|
|
run: docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/moneyprinterturbo-api:$GITHUB_SHA
|
|
|
|
- name: Deploy webui to Cloud Run
|
|
run: |
|
|
gcloud run deploy moneyprinterturbo-webui \
|
|
--image gcr.io/${{ secrets.GCP_PROJECT_ID }}/moneyprinterturbo-webui:$GITHUB_SHA \
|
|
--platform managed \
|
|
--region ${{ secrets.GCP_REGION }} \
|
|
--allow-unauthenticated
|
|
|
|
- name: Deploy api to Cloud Run
|
|
run: |
|
|
gcloud run deploy moneyprinterturbo-api \
|
|
--image gcr.io/${{ secrets.GCP_PROJECT_ID }}/moneyprinterturbo-api:$GITHUB_SHA \
|
|
--platform managed \
|
|
--region ${{ secrets.GCP_REGION }} \
|
|
--allow-unauthenticated |