diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 3d5061b9..ca5cbf12 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -1,17 +1,57 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools - name: Deploy to Firebase Hosting on PR -'on': pull_request + +'on': + pull_request: + branches: + - main + jobs: build_and_preview: - if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - run: npm ci && npm run build + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.19.0' + + - name: Create .env file for PR + run: | + echo "REACT_APP_FIREBASE_API_KEY=${{ secrets.REACT_APP_FIREBASE_API_KEY }}" >> .env.production + echo "REACT_APP_FIREBASE_APP_ID=${{ secrets.REACT_APP_FIREBASE_APP_ID }}" >> .env.production + echo "REACT_APP_FIREBASE_AUTH_DOMAIN=${{ secrets.REACT_APP_FIREBASE_AUTH_DOMAIN }}" >> .env.production + echo "REACT_APP_FIREBASE_DATABASE_URL=${{ secrets.REACT_APP_FIREBASE_DATABASE_URL }}" >> .env.production + echo "REACT_APP_FIREBASE_MEASUREMENT_ID=${{ secrets.REACT_APP_FIREBASE_MEASUREMENT_ID }}" >> .env.production + echo "REACT_APP_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.REACT_APP_FIREBASE_MESSAGING_SENDER_ID }}" >> .env.production + echo "REACT_APP_FIREBASE_PROJECT_ID=${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}" >> .env.production + echo "REACT_APP_FIREBASE_STORAGE_BUCKET=${{ secrets.REACT_APP_FIREBASE_STORAGE_BUCKET }}" >> .env.production + echo "REACT_APP_GOOGLE_MAPS_API_KEY=${{ secrets.REACT_APP_GOOGLE_MAPS_API_KEY }}" >> .env.production + echo "REACT_APP_RECAPTCHA_SITE_KEY=${{ secrets.REACT_APP_RECAPTCHA_SITE_KEY }}" >> .env.production + + - name: Install dependencies + run: npm install + + # This step is optional in PR, mainly for debugging purpose + # Remove if not needed + - name: Print environment variables + run: | + echo "REACT_APP_FIREBASE_PROJECT_ID: $REACT_APP_FIREBASE_PROJECT_ID" + echo "secrets.REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}" + echo "REACT_APP_FIREBASE_AUTH_DOMAIN: $REACT_APP_FIREBASE_AUTH_DOMAIN" + echo "secrets.FIREBASE_SERVICE_ACCOUNT_BIKEBUS_71DD5: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_BIKEBUS_71DD5 }}" + echo "secrets.GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}" + + - name: Build for PR + run: npm run build + - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_BIKEBUS_71DD5 }}' projectId: bikebus-71dd5 + # Specify a preview channel if you want a unique URL for this PR + # If you want to deploy to the live channel, remove this line + # channelId: ${{ github.event.pull_request.head.ref }} diff --git a/firebase-debug.log b/firebase-debug.log new file mode 100644 index 00000000..54acd99e --- /dev/null +++ b/firebase-debug.log @@ -0,0 +1,14 @@ +[debug] [2024-04-23T18:29:18.288Z] ---------------------------------------------------------------------- +[debug] [2024-04-23T18:29:18.290Z] Command: C:\Program Files\nodejs\node.exe C:\Users\CraigM\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js login +[debug] [2024-04-23T18:29:18.290Z] CLI Version: 13.7.3 +[debug] [2024-04-23T18:29:18.291Z] Platform: win32 +[debug] [2024-04-23T18:29:18.291Z] Node Version: v18.19.0 +[debug] [2024-04-23T18:29:18.297Z] Time: Tue Apr 23 2024 11:29:18 GMT-0700 (Pacific Daylight Time) +[debug] [2024-04-23T18:29:18.298Z] ---------------------------------------------------------------------- +[debug] +[debug] [2024-04-23T18:29:18.301Z] >>> [apiv2][query] GET https://firebase-public.firebaseio.com/cli.json [none] +[info] i Firebase optionally collects CLI and Emulator Suite usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you. + +[debug] [2024-04-23T18:29:18.503Z] *** [apiv2] error from fetch(https://firebase-public.firebaseio.com/cli.json, {"headers":{},"method":"GET"}): FetchError: request to https://firebase-public.firebaseio.com/cli.json failed, reason: unable to verify the first certificate +[warn] ! Unable to fetch the CLI MOTD and remote config. This is not a fatal error, but may indicate an issue with your network connection. +[debug] [2024-04-23T18:29:18.504Z] Failed to fetch MOTD FirebaseError: Failed to make request to https://firebase-public.firebaseio.com/cli.json