Update google-cloudrun-docker.yml #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| credentials_json: '${{ secrets.GCP_SA_KEY }}' | |
| project_id: ${{ env.PROJECT_ID }} | |
| # 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 |