Google Cloud Run cannot read .env. staging file when deployed using GitHub Actions, whereas I've included the .env.staging file in .gcloudignore.
This is my .gcloudignore:
.gcloudignore
.git
!.env.staging
!service-account.json
The .env.staging file should be exist in Cloud Run container and my API should be able to read it.
My API cannot read the .env.staging file and caused deployment error when using Github Actions
name: CI/CD to Google Cloud Run
on:
release:
types:
- published
jobs:
main:
name: Continous Deployment to Google Cloud Run
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/[email protected]
- id: auth
name: Authenticate service account
uses: google-github-actions/[email protected]
with:
credentials_json: ${{secrets.SERVICE_ACCOUNT_JSON}}
- id: gcloud
name: Setup Google Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: ${{secrets.GCP_PROJECT_ID}}
- id: deploy
name: Deploy API to Google Cloud Run
run: gcloud builds submit --config deployments/cloudbuild.staging.yaml
I don't know it's a bug or not, but when I deployed my API using gcloud command line locally, it worked fine. The error only happen when using Github Actions.
Any solutions?
Thanks.
Owner Name | google-github-actions |
Repo Name | setup-gcloud |
Full Name | google-github-actions/setup-gcloud |
Language | TypeScript |
Created Date | 2019-11-05 |
Updated Date | 2023-03-23 |
Star Count | 1505 |
Watcher Count | 65 |
Fork Count | 548 |
Issue Count | 11 |
Issue Title | Created Date | Updated Date |
---|