From ffe3fb44199133234ef16ebc96290d94410137b1 Mon Sep 17 00:00:00 2001 From: faycal Date: Sun, 9 Mar 2025 23:43:54 +0100 Subject: [PATCH] feat(deploy): add gcp deploy --- .github/workflows/deploy.yml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..9c3d509 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,40 @@ +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 + 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 \ No newline at end of file