Skip to content

Update google-cloudrun-docker.yml #11

Update google-cloudrun-docker.yml

Update google-cloudrun-docker.yml #11

name: Deploy Angular App to Cloud Run
on:
push:
branches: [ "main" ]
permissions:
contents: read
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 1) Check out your code
- uses: actions/checkout@v4
# 2) Authenticate to Google Cloud (Direct Workload Identity Federation)
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
project_id: "angularblogcloud-455518"
workload_identity_provider: "projects/863451014992/locations/global/workloadIdentityPools/github/providers/my-repo"
# 3) Install & configure gcloud CLI
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
export_default_credentials: true
# 4) Configure region (no API enabling here)
- name: Configure gcloud
run: |
gcloud config set project ${{ steps.auth.outputs.project_id }}
gcloud config set run/region europe-central2
# 5) Install Node.js dependencies
- name: Install Node dependencies
run: npm install
# 6) Build Angular
- name: Build Angular
run: npm run build -- --configuration production
# 7) Deploy to Cloud Run
- name: Deploy to Cloud Run
run: |
gcloud run deploy angular-blog-service \
--source . \
--allow-unauthenticated