Skip to content

Update main.yml

Update main.yml #2

Workflow file for this run

name: Deploy to Google Cloud Run
on:
push:
branches:
- main # Adjust the branch name as needed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
run: |
docker buildx build -t sleppp/inventory-backend --platform linux/amd64 .
docker tag sleppp/inventory-backend gcr.io/inventory-database-420916/inventory-backend
docker push gcr.io/inventory-database-420916/inventory-backend:latest
- name: Set up Google Cloud SDK
uses: GoogleCloudPlatform/github-actions/[email protected]
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Deploy to Cloud Run
run: |
gcloud run deploy inventory-backend \
--image gcr.io/inventory-database-420916/inventory-backend \
--platform managed \
--region us-central1 \
--allow-unauthenticated