Bump the npm_and_yarn group across 1 directory with 3 updates #13
This file contains 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 to Cloud Run (PR preview) | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
pull-requests: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
token_format: access_token | |
workload_identity_provider: 'projects/292061085119/locations/global/workloadIdentityPools/github-pool/providers/provider-github' | |
service_account: 'gh-actions@ynufes-hp-cloudrun.iam.gserviceaccount.com' | |
- name: Set up Cloud SDK | |
uses: 'google-github-actions/setup-gcloud@v2' | |
with: | |
version: '>= 363.0.0' | |
- name: Authorize Docker | |
id: docker-auth | |
uses: docker/login-action@v3 | |
with: | |
username: 'oauth2accesstoken' | |
password: ${{ steps.auth.outputs.access_token }} | |
registry: asia-northeast1-docker.pkg.dev | |
# custom step for seiryo23 | |
- name: configure production mode | |
run: | | |
echo "PRODUCTION_MODE=false" >> .env | |
- name: Download events.json from external URL | |
run: | | |
curl "${{ secrets.EVENTS_DATA_URL }}" -o ./assets/data/events.json | |
# custom step for seiryo23 ends here | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: asia-northeast1-docker.pkg.dev/ynufes-hp-cloudrun/staging/seiryo23-pr-${{ github.event.number }}:latest | |
context: . | |
file: ./cloudrun/Dockerfile | |
- name: Deploy to Cloud Run | |
id: deploy | |
uses: google-github-actions/deploy-cloudrun@v2 | |
with: | |
service: seiryo23-stg-pr-${{ github.event.number }} | |
region: "asia-northeast1" | |
image: asia-northeast1-docker.pkg.dev/ynufes-hp-cloudrun/staging/seiryo23-pr-${{ github.event.number }}:latest | |
- name: Make CloudRun accessible | |
run: | | |
gcloud run services add-iam-policy-binding seiryo23-stg-pr-${{ github.event.number }} --region=asia-northeast1 --member=allUsers --role=roles/run.invoker | |
- name: Post comments | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
URL: ${{ github.event.pull_request.html_url }} | |
run: | |
gh pr comment -b "Deployed on ${{ steps.deploy.outputs.url }}" ${{ github.event.number }} |