diff --git a/.firebaserc b/.firebaserc index f3d07c94..19b10523 100644 --- a/.firebaserc +++ b/.firebaserc @@ -1,6 +1,7 @@ { "projects": { - "default": "nwplus-ubc" + "default": "nwplus-ubc", + "dev": "nwplus-ubc-dev" }, "targets": { "nwplus-ubc": { @@ -9,6 +10,14 @@ "nw-admin-portal" ] } + }, + "nwplus-ubc-dev": { + "hosting": { + "admin-portal": [ + "dev-nwplus-admin" + ] + } } - } + }, + "etags": {} } \ No newline at end of file diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 7a0130ed..0a7232ad 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -4,17 +4,22 @@ name: Deploy to Firebase Hosting on merge 'on': push: - branches: - - main + branches: [main, dev] + workflow_dispatch: jobs: build_and_deploy: runs-on: ubuntu-latest + env: + IS_PRODUCTION: ${{ endsWith(github.ref, 'main') }} + NODE_OPTIONS: --openssl-legacy-provider steps: - uses: actions/checkout@v3 - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' + - name: Set up Firebase CLI + run: yarn global add firebase-tools - name: Install and Build run: yarn install --frozen-lockfile && yarn build env: @@ -28,7 +33,21 @@ jobs: NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }} SERVICE_ACCOUNT_TOKEN: ${{ secrets.SERVICE_ACCOUNT_TOKEN }} FIREBASE_CLI_PREVIEWS: hostingchannels - - uses: FirebaseExtended/action-hosting-deploy@v0 + # - name: Deploy to dev firebase project + # if: ${{ env.IS_PRODUCTION == 'false' }} + # run: firebase deploy --only hosting:admin-portal --project nwplus-ubc-dev --non-interactive --token ${{ secrets.FIREBASE_TOKEN }} + - name: Deploy to dev firebase project + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' + projectId: nwplus-ubc-dev + target: admin-portal + channelId: live + firebaseToolsVersion: 12.9.1 + - name: Deploy to prod firebase project + if: ${{ env.IS_PRODUCTION == 'true' }} + uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}'