fix: debug github workflow cannot find package.json error #32
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 NestJS API to Firebase | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
checks: write | |
contents: write | |
deployments: write | |
id-token: write # This is required for requesting the JWT | |
issues: write | |
packages: write | |
pages: write | |
pull-requests: write | |
repository-projects: write | |
security-events: write | |
statuses: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: github/actions-oidc-debugger | |
ref: main | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: ./.github/actions/actions-oidc-debugger | |
- name: Debug OIDC Claims | |
uses: ./.github/actions/actions-oidc-debugger | |
with: | |
audience: 'projects/970886652672/locations/global/workloadIdentityPools/dev-ci-pool/providers/my-repo-oidc' | |
- name: Set correct firebase project based on git branch. | |
run: echo "FIREBASE_PROJECT=$(if [ ${{ github.ref }} == 'refs/heads/main' ]; then echo 'prod'; else echo 'dev'; fi)" >> $GITHUB_ENV | |
- id: 'auth' | |
name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
project_id: ${{ env.FIREBASE_PROJECT }} | |
workload_identity_provider: 'projects/970886652672/locations/global/workloadIdentityPools/dev-ci-pool/providers/my-repo-oidc' | |
# service_account: '[email protected]' | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies. | |
working-directory: ./ | |
run: | | |
ls -l | |
npm ci | |
- name: Deploy to firebase cloud functions. | |
uses: w9jds/[email protected] | |
with: | |
args: deploy --only functions --project ${{ env.FIREBASE_PROJECT }} | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} |