Fix Cloud Run deployment: correct Angular project name and improve Do… #62
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 Blog to Cloud Run | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: npm | |
| - run: npm ci | |
| - uses: browser-actions/setup-chrome@v1 | |
| - name: Use Chrome with no-sandbox | |
| run: | | |
| printf '#!/usr/bin/env bash\nexec "%s" --no-sandbox --disable-setuid-sandbox "$@"\n' "$(which chrome)" > /tmp/chrome-nosandbox.sh | |
| chmod +x /tmp/chrome-nosandbox.sh | |
| echo "CHROME_BIN=/tmp/chrome-nosandbox.sh" >> $GITHUB_ENV | |
| - run: sudo mount -t tmpfs tmpfs /dev/shm -o size=2G | |
| - run: xvfb-run -a npm run test -- --browsers=ChromeHeadless --watch=false --no-progress | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: '${{ secrets.GCP_SA_KEY }}' | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v1 | |
| - name: Configure Docker for GCR | |
| run: gcloud auth configure-docker | |
| - name: Build and Deploy to Cloud Run | |
| uses: google-github-actions/deploy-cloudrun@v2 | |
| with: | |
| service: angular-blog | |
| region: europe-west4 | |
| source: . | |
| flags: '--verbosity=debug --timeout=1200' | |
| env_vars: | | |
| NODE_ENV=production |