From fc18691c256c5a9eb3cafa784f57429bb35aadd5 Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Thu, 2 Jan 2025 00:29:29 -0800 Subject: [PATCH 01/21] did it work? --- .firebaserc | 13 +++++++++++-- .github/workflows/firebase-hosting-merge.yml | 19 ++++++++++--------- 2 files changed, 21 insertions(+), 11 deletions(-) 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..511e9dd7 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -4,11 +4,12 @@ name: Deploy to Firebase Hosting on merge 'on': push: - branches: - - main + branches: [main, dev, bywang/dev-env] jobs: build_and_deploy: runs-on: ubuntu-latest + env: + IS_PRODUCTION: ${{ endsWith(github.ref, 'main') }} steps: - uses: actions/checkout@v3 - name: Use Node.js @@ -28,10 +29,10 @@ 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 - with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' - channelId: live - projectId: nwplus-ubc - firebaseToolsVersion: 12.9.1 + - name: Deploy to dev firebase project + if: ${{ env.IS_PRODUCTION == 'false' }} + run: firebase deploy --only hosting:admin-portal --non-interactive --token ${{ secrets.FIREBASE_TOKEN }} + + - name: Deploy to prod firebase project + if: ${{ env.IS_PRODUCTION == 'true' }} + run: firebase deploy --only hosting:admin-portal --non-interactive --token ${{ secrets.FIREBASE_TOKEN }} From a30790e7d136b94cc6e8149a482ab2ebdffe7fea Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Thu, 2 Jan 2025 00:34:52 -0800 Subject: [PATCH 02/21] pls fix --- .github/workflows/firebase-hosting-merge.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 511e9dd7..ea9851d6 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -31,8 +31,19 @@ jobs: FIREBASE_CLI_PREVIEWS: hostingchannels - name: Deploy to dev firebase project if: ${{ env.IS_PRODUCTION == 'false' }} - run: firebase deploy --only hosting:admin-portal --non-interactive --token ${{ secrets.FIREBASE_TOKEN }} - + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' + channelId: dev + projectId: nwplus-ubc-dev + firebaseToolsVersion: 12.9.1 - name: Deploy to prod firebase project if: ${{ env.IS_PRODUCTION == 'true' }} - run: firebase deploy --only hosting:admin-portal --non-interactive --token ${{ secrets.FIREBASE_TOKEN }} + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' + channelId: live + projectId: nwplus-ubc + firebaseToolsVersion: 12.9.1 From b61c06ecd5a6827b5c830bd461e41fd421ff9dc1 Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Thu, 2 Jan 2025 00:40:58 -0800 Subject: [PATCH 03/21] key that does not even exist removed --- .github/workflows/firebase-hosting-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index ea9851d6..e1beb53d 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -34,7 +34,7 @@ jobs: uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' channelId: dev projectId: nwplus-ubc-dev firebaseToolsVersion: 12.9.1 From 0f574c6bba33fcfa6a51e4f0119d6a3b61c60dab Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Thu, 2 Jan 2025 00:47:21 -0800 Subject: [PATCH 04/21] a test --- .github/workflows/firebase-hosting-merge.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index e1beb53d..d1e29d06 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -29,15 +29,15 @@ jobs: NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }} SERVICE_ACCOUNT_TOKEN: ${{ secrets.SERVICE_ACCOUNT_TOKEN }} FIREBASE_CLI_PREVIEWS: hostingchannels - - name: Deploy to dev firebase project - if: ${{ env.IS_PRODUCTION == 'false' }} - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' - channelId: dev - projectId: nwplus-ubc-dev - firebaseToolsVersion: 12.9.1 + # - name: Deploy to dev firebase project + # if: ${{ env.IS_PRODUCTION == 'false' }} + # uses: FirebaseExtended/action-hosting-deploy@v0 + # with: + # repoToken: '${{ secrets.GITHUB_TOKEN }}' + # firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' + # channelId: dev + # projectId: nwplus-ubc-dev + # firebaseToolsVersion: 12.9.1 - name: Deploy to prod firebase project if: ${{ env.IS_PRODUCTION == 'true' }} uses: FirebaseExtended/action-hosting-deploy@v0 From 4660d5074cc8d03eac0b8257f002ff43f3f5620e Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Fri, 3 Jan 2025 15:09:51 -0800 Subject: [PATCH 05/21] another test --- .github/workflows/debug-client-email.yml | 14 ++++++++++++++ .github/workflows/firebase-hosting-merge.yml | 18 +++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/debug-client-email.yml diff --git a/.github/workflows/debug-client-email.yml b/.github/workflows/debug-client-email.yml new file mode 100644 index 00000000..4df69a59 --- /dev/null +++ b/.github/workflows/debug-client-email.yml @@ -0,0 +1,14 @@ +name: Debug Firebase Service Account + +on: workflow_dispatch # Allows you to manually trigger this workflow from the GitHub Actions tab. + +jobs: + debug: + runs-on: ubuntu-latest + steps: + - name: Save Firebase Service Account JSON + run: | + echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' > service-account.json + - name: Extract client_email + run: | + jq '.client_email' service-account.json diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index d1e29d06..e1beb53d 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -29,15 +29,15 @@ jobs: NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }} SERVICE_ACCOUNT_TOKEN: ${{ secrets.SERVICE_ACCOUNT_TOKEN }} FIREBASE_CLI_PREVIEWS: hostingchannels - # - name: Deploy to dev firebase project - # if: ${{ env.IS_PRODUCTION == 'false' }} - # uses: FirebaseExtended/action-hosting-deploy@v0 - # with: - # repoToken: '${{ secrets.GITHUB_TOKEN }}' - # firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' - # channelId: dev - # projectId: nwplus-ubc-dev - # firebaseToolsVersion: 12.9.1 + - name: Deploy to dev firebase project + if: ${{ env.IS_PRODUCTION == 'false' }} + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' + channelId: dev + projectId: nwplus-ubc-dev + firebaseToolsVersion: 12.9.1 - name: Deploy to prod firebase project if: ${{ env.IS_PRODUCTION == 'true' }} uses: FirebaseExtended/action-hosting-deploy@v0 From 2f6f66cc304bf5eb5a615f760ae42135303008d5 Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Fri, 3 Jan 2025 15:36:31 -0800 Subject: [PATCH 06/21] test test --- .github/workflows/debug-client-email.yml | 14 -------------- .github/workflows/firebase-hosting-merge.yml | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 .github/workflows/debug-client-email.yml diff --git a/.github/workflows/debug-client-email.yml b/.github/workflows/debug-client-email.yml deleted file mode 100644 index 4df69a59..00000000 --- a/.github/workflows/debug-client-email.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Debug Firebase Service Account - -on: workflow_dispatch # Allows you to manually trigger this workflow from the GitHub Actions tab. - -jobs: - debug: - runs-on: ubuntu-latest - steps: - - name: Save Firebase Service Account JSON - run: | - echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' > service-account.json - - name: Extract client_email - run: | - jq '.client_email' service-account.json diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index e1beb53d..ea9851d6 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -34,7 +34,7 @@ jobs: uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' channelId: dev projectId: nwplus-ubc-dev firebaseToolsVersion: 12.9.1 From afed5922bd7aef2f8e049a7adac5cef5d2bc8399 Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Fri, 3 Jan 2025 15:46:01 -0800 Subject: [PATCH 07/21] woah --- .github/workflows/firebase-hosting-merge.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index ea9851d6..e3d08d41 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -35,7 +35,6 @@ jobs: with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' - channelId: dev projectId: nwplus-ubc-dev firebaseToolsVersion: 12.9.1 - name: Deploy to prod firebase project From ab752ddf424549f74970076966b44572155b7bee Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Fri, 3 Jan 2025 15:56:41 -0800 Subject: [PATCH 08/21] test --- .github/workflows/firebase-hosting-merge.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index e3d08d41..39047cdc 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -29,14 +29,17 @@ jobs: NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }} SERVICE_ACCOUNT_TOKEN: ${{ secrets.SERVICE_ACCOUNT_TOKEN }} FIREBASE_CLI_PREVIEWS: hostingchannels + # - name: Deploy to dev firebase project + # if: ${{ env.IS_PRODUCTION == 'false' }} + # uses: FirebaseExtended/action-hosting-deploy@v0 + # with: + # repoToken: '${{ secrets.GITHUB_TOKEN }}' + # firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' + # projectId: nwplus-ubc-dev + # firebaseToolsVersion: 12.9.1 - name: Deploy to dev firebase project if: ${{ env.IS_PRODUCTION == 'false' }} - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' - projectId: nwplus-ubc-dev - firebaseToolsVersion: 12.9.1 + run: firebase deploy --only hosting:admin-portal --project nwplus-ubc-dev --non-interactive --token ${{ secrets.FIREBASE_TOKEN }} - name: Deploy to prod firebase project if: ${{ env.IS_PRODUCTION == 'true' }} uses: FirebaseExtended/action-hosting-deploy@v0 From cc5e5c041e3d6a7f54729ad144d51e256bdf618d Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Fri, 3 Jan 2025 16:00:28 -0800 Subject: [PATCH 09/21] adding tools --- .github/workflows/firebase-hosting-merge.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 39047cdc..0259098c 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -16,6 +16,8 @@ jobs: uses: actions/setup-node@v3 with: node-version: '16.x' + - name: Set up Firebase CLI + run: yarn global add firebase-tools - name: Install and Build run: yarn install --frozen-lockfile && yarn build env: From 1fd725b63c98f42d73780a07aa487bd7b11fa412 Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Fri, 3 Jan 2025 16:02:31 -0800 Subject: [PATCH 10/21] node upgrade --- .github/workflows/firebase-hosting-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 0259098c..f8225ab0 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -15,7 +15,7 @@ jobs: - 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 From 0db8101b27e26db82efbbd591c36e1a608251780 Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Fri, 3 Jan 2025 16:06:02 -0800 Subject: [PATCH 11/21] openssl bug fix? --- .github/workflows/firebase-hosting-merge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index f8225ab0..2265c7f3 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -10,6 +10,7 @@ jobs: 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 From e93736e5591ab0ccdff943d10d17bcd50467e1c9 Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Fri, 3 Jan 2025 16:18:01 -0800 Subject: [PATCH 12/21] finally lol --- .github/workflows/firebase-hosting-merge.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 2265c7f3..8ec6665b 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -4,7 +4,7 @@ name: Deploy to Firebase Hosting on merge 'on': push: - branches: [main, dev, bywang/dev-env] + branches: [main, dev] jobs: build_and_deploy: runs-on: ubuntu-latest @@ -32,14 +32,6 @@ jobs: NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }} SERVICE_ACCOUNT_TOKEN: ${{ secrets.SERVICE_ACCOUNT_TOKEN }} FIREBASE_CLI_PREVIEWS: hostingchannels - # - name: Deploy to dev firebase project - # if: ${{ env.IS_PRODUCTION == 'false' }} - # uses: FirebaseExtended/action-hosting-deploy@v0 - # with: - # repoToken: '${{ secrets.GITHUB_TOKEN }}' - # firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' - # projectId: nwplus-ubc-dev - # firebaseToolsVersion: 12.9.1 - 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 }} From 3e30e9cbf7c3ce2b45e380e21c875b28390fe9ec Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Sat, 11 Jan 2025 20:45:34 -0800 Subject: [PATCH 13/21] lets try to fix no permissions --- .github/workflows/firebase-hosting-merge.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 8ec6665b..a669f199 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -32,9 +32,16 @@ jobs: NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }} SERVICE_ACCOUNT_TOKEN: ${{ secrets.SERVICE_ACCOUNT_TOKEN }} FIREBASE_CLI_PREVIEWS: hostingchannels + # - 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 - if: ${{ env.IS_PRODUCTION == 'false' }} - run: firebase deploy --only hosting:admin-portal --project nwplus-ubc-dev --non-interactive --token ${{ secrets.FIREBASE_TOKEN }} + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' + projectId: nwplus-ubc-dev + firebaseToolsVersion: 12.9.1 - name: Deploy to prod firebase project if: ${{ env.IS_PRODUCTION == 'true' }} uses: FirebaseExtended/action-hosting-deploy@v0 From 913f339dedcccf20ec15244e39dbca2f0336689e Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Sat, 11 Jan 2025 20:54:15 -0800 Subject: [PATCH 14/21] avoid preview link --- .github/workflows/firebase-hosting-merge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index a669f199..0bad8248 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -40,6 +40,7 @@ jobs: with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' + channelId: live projectId: nwplus-ubc-dev firebaseToolsVersion: 12.9.1 - name: Deploy to prod firebase project From 7f08370e9192483032338657fafa86debac5943f Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Sat, 11 Jan 2025 20:59:20 -0800 Subject: [PATCH 15/21] specified target --- .github/workflows/firebase-hosting-merge.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 0bad8248..0dedfaf6 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -40,8 +40,9 @@ jobs: with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NWPLUS_UBC_DEV }}' - channelId: live projectId: nwplus-ubc-dev + target: admin-portal + channelId: live firebaseToolsVersion: 12.9.1 - name: Deploy to prod firebase project if: ${{ env.IS_PRODUCTION == 'true' }} From 0be0260ef27273368e38790eb13627f2600239f8 Mon Sep 17 00:00:00 2001 From: byronwang93 Date: Sat, 11 Jan 2025 21:00:45 -0800 Subject: [PATCH 16/21] added my branch back --- .github/workflows/firebase-hosting-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 0dedfaf6..6f00d0b2 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -4,7 +4,7 @@ name: Deploy to Firebase Hosting on merge 'on': push: - branches: [main, dev] + branches: [main, dev, bywang/dev-env] jobs: build_and_deploy: runs-on: ubuntu-latest From 8b34005a27723a29e258927327c34ebb103b40fe Mon Sep 17 00:00:00 2001 From: Lincoln Lee Date: Tue, 6 May 2025 23:50:57 -0700 Subject: [PATCH 17/21] feat: add manual workflow button --- .github/workflows/firebase-hosting-merge.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 6f00d0b2..0a7232ad 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -4,7 +4,8 @@ name: Deploy to Firebase Hosting on merge 'on': push: - branches: [main, dev, bywang/dev-env] + branches: [main, dev] + workflow_dispatch: jobs: build_and_deploy: runs-on: ubuntu-latest From 16327a051dd7fbaa08b9f5b599252319af5dd2c8 Mon Sep 17 00:00:00 2001 From: Lincoln Lee Date: Thu, 22 May 2025 16:36:48 -0700 Subject: [PATCH 18/21] chore: fix linter errors --- pages/[id]/HackerInfo.js | 80 ++++++++++------------------------------ utility/firebase.js | 17 +++++---- 2 files changed, 28 insertions(+), 69 deletions(-) diff --git a/pages/[id]/HackerInfo.js b/pages/[id]/HackerInfo.js index 1d89d784..a9e79469 100644 --- a/pages/[id]/HackerInfo.js +++ b/pages/[id]/HackerInfo.js @@ -105,29 +105,18 @@ export default function HackerInfo({ id, hackathons }) { const [currTable, setCurrTable] = useState('Applicants') const [unfilteredTableKeys, setUnfilteredTableKeys] = useState([]) const [filteredTableKeys, setFilteredTableKeys] = useState([]) - const [groupBy, setGroupBy] = useState({ - col1: '', - func: '', - col2: '', - }) - const [where, setWhere] = useState({ - col: '', - func: '', - val: '', - }) - const [sort, setSort] = useState({ - col: '', - direction: '', - }) + const [groupBy, setGroupBy] = useState({ col1: '', func: '', col2: '' }) + const [where, setWhere] = useState({ col: '', func: '', val: '' }) + const [sort, setSort] = useState({ col: '', direction: '' }) const [filter, setFilter] = useState({}) const [calculate, setCalculate] = useState({}) const downloadLink = useRef() const clearFilters = () => { setGroupBy({ col1: '', func: '', col2: '' }) - setFilter({ col: '', func: '', val: '' }) - setSort({ col: '', direction: '' }) setFilter({}) + setSort({ col: '', direction: '' }) + setWhere({ col: '', func: '', val: '' }) } useEffect(() => { @@ -171,7 +160,6 @@ export default function HackerInfo({ id, hackathons }) { const saveWhere = () => { const condition = {} if (['NIS', 'NEQ'].includes(where.func)) { - // negation condition condition.NOT = { [where.func.substring(1)]: { [where.col]: where.func === 'NEQ' ? Number(where.val) : where.val, @@ -198,15 +186,13 @@ export default function HackerInfo({ id, hackathons }) { }) } - const HackerInfoRow = ({ data }) => { - return ( - - {filteredTableKeys.map(key => ( - {data[key]} - ))} - - ) - } + const HackerInfoRow = ({ data }) => ( + + {filteredTableKeys.map(key => ( + {data[key]} + ))} + + ) const renderTable = useMemo( () => ( @@ -262,7 +248,7 @@ export default function HackerInfo({ id, hackathons }) { {filteredData.map(entry => ( - + ))} @@ -289,13 +275,7 @@ export default function HackerInfo({ id, hackathons }) { ))} - + @@ -387,12 +367,7 @@ export default function HackerInfo({ id, hackathons }) { ))} {groupBy.col1 && groupBy.func && groupBy.col2 && ( - - + - - diff --git a/utility/firebase.js b/utility/firebase.js index 245ec0c2..2a90ffe8 100644 --- a/utility/firebase.js +++ b/utility/firebase.js @@ -754,7 +754,6 @@ export const getCSVData = async () => { return CSV } - // export const getRaffleNumbers = async () => { // const apps = await db // .collection('Hackathons') @@ -789,10 +788,10 @@ export const getCSVData = async () => { // .doc(e.eventId) // .get() // ); - + // // Wait for all dayOfDocs to resolve // const dayOfDocs = await Promise.all(dayOfDocsPromises); - + // // Calculate total points from events // const totalPoints = dayOfDocs.reduce( // (acc, curr) => acc + Number(curr.data()?.points ?? 0), @@ -839,62 +838,51 @@ export const getRaffleWheelEmails = async () => { .doc(HackerEvaluationHackathon) .collection('Applicants') .where('dayOf.checkedIn', '==', true) - .get(); + .get() // Create an array to hold all rows for the raffle entries - const raffleEntries = []; - let counter = 1; // Initialize a counter + const raffleEntries = [] + let counter = 1 // Initialize a counter // Iterate over the documents and calculate raffle entries for each user for (const doc of apps.docs) { const { basicInfo: { email, legalFirstName, preferredName, legalLastName }, dayOf, - } = doc.data(); + } = doc.data() - if (!dayOf?.events || !Array.isArray(dayOf.events)) continue; + if (!dayOf?.events || !Array.isArray(dayOf.events)) continue // Determine the name to use - const displayName = (preferredName?.trim() || legalFirstName) + " " + legalLastName; + const displayName = `${preferredName?.trim() || legalFirstName} ${legalLastName}` // Fetch event documents for each event in dayOf.events - const dayOfDocsPromises = dayOf.events.map((e) => - db - .collection('Hackathons') - .doc(HackerEvaluationHackathon) - .collection('DayOf') - .doc(e.eventId) - .get() - ); + const dayOfDocsPromises = dayOf.events.map(e => + db.collection('Hackathons').doc(HackerEvaluationHackathon).collection('DayOf').doc(e.eventId).get() + ) - const dayOfDocs = await Promise.all(dayOfDocsPromises); + const dayOfDocs = await Promise.all(dayOfDocsPromises) // Calculate total points from events (+15 from check-in) - const totalPoints = - 15 + - dayOfDocs.reduce((acc, curr) => acc + Number(curr.data()?.points ?? 0), 0); + const totalPoints = 15 + dayOfDocs.reduce((acc, curr) => acc + Number(curr.data()?.points ?? 0), 0) // Calculate raffle entries based on total points - const totalRaffleEntries = Math.floor(totalPoints / 15); + const totalRaffleEntries = Math.floor(totalPoints / 15) // Add the user's data multiple times based on raffle entries for (let i = 0; i < totalRaffleEntries; i++) { - raffleEntries.push([counter, `${displayName} [${counter}]`, email]); - counter++; // Increment counter + raffleEntries.push([counter, `${displayName} [${counter}]`, email]) + counter++ // Increment counter } } // Prepare CSV with "Number", "First Name + Number", and "Raffle Entries" columns - const CSV = [ - ['Number', 'Name + Number', 'Raffle Entries'], - ...raffleEntries, - ]; - - console.log(CSV); + const CSV = [['Number', 'Name + Number', 'Raffle Entries'], ...raffleEntries] - return CSV; -}; + console.log(CSV) + return CSV +} export const getResumeFile = async userId => { try { From 6b42b42fe7f3d6ce3b07bdbe0ba7bebf99c3baeb Mon Sep 17 00:00:00 2001 From: Lincoln Lee Date: Tue, 3 Jun 2025 08:04:54 -0700 Subject: [PATCH 21/21] fix: remove unary operator --- utility/firebase.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utility/firebase.js b/utility/firebase.js index 2a90ffe8..09cc5198 100644 --- a/utility/firebase.js +++ b/utility/firebase.js @@ -870,9 +870,9 @@ export const getRaffleWheelEmails = async () => { const totalRaffleEntries = Math.floor(totalPoints / 15) // Add the user's data multiple times based on raffle entries - for (let i = 0; i < totalRaffleEntries; i++) { + for (let i = 0; i < totalRaffleEntries; i += 1) { raffleEntries.push([counter, `${displayName} [${counter}]`, email]) - counter++ // Increment counter + counter += 1 // Increment counter } }