Skip to content

fix: address code review findings from PR #147 #135

fix: address code review findings from PR #147

fix: address code review findings from PR #147 #135

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Deploy to Test
on:
push:
branches: ["test"]
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
#FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
NEXT_PUBLIC_FIREBASE_CONFIG: ${{ secrets.FIREBASE_TEST_CONFIG }}
NEXT_PUBLIC_CLIENT_ID: ${{ secrets.TEST_CLIENT_ID }}
NEXT_PUBLIC_REDIRECT_URI: "https://datapipe-test.web.app/oauth2/callback"
NEXT_PUBLIC_OAUTH_CALLBACK: "https://datapipe-test.web.app/api/oauth2callback"
NEXT_PUBLIC_OAUTH_FINAL: "/admin"
NEXT_PUBLIC_OAUTH_REGENERATE: "https://datapipe-test.web.app/api/oauth2regenerate"
NEXT_PUBLIC_GENERATE_STATE: "https://datapipe-test.web.app/api/generateoauthstate"
NEXT_PUBLIC_BASE_URL: "https://datapipe-test.web.app"
NEXT_PUBLIC_OSF_ENV: ""
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- uses: 'google-github-actions/auth@v3'
with:
credentials_json: '${{ secrets.GOOGLE_TEST_CREDENTIALS }}' # Replace with the name of your GitHub Actions secret
- name: Install firebase tools
run: npm install -g firebase-tools@15.8.0
- name: Enable firebase webframeworks
run: firebase experiments:enable webframeworks
- name: Install dependencies
run: npm ci
- name: Install dependencies and build metadata
working-directory: functions/metadata
run: |
npm ci
npm run build
- name: Create functions environment file
working-directory: functions
run: |
echo "CLIENT_SECRET=${{ secrets.TEST_CLIENT_SECRET }}" > .env
echo "CLIENT_ID=${{ secrets.TEST_CLIENT_ID }}" >> .env
echo "REDIRECT_URI=https://datapipe-test.web.app/oauth2/callback" >> .env
echo "TOKEN_ENCRYPTION_KEY=${{ secrets.FIRESTORE_KEY_TEST }}" >> .env
echo "NEXT_PUBLIC_OSF_ENV=" >> .env
- name: Install dependencies and build functions
working-directory: functions
run: |
npm ci
npm run build
- name: Use test firebase project
run: firebase use test
- name: Deploy firebase project
run: firebase deploy --only firestore,functions,hosting --force