From 8b64d69739ef280b5cc7d45a7d4290ed1db8fbfb Mon Sep 17 00:00:00 2001 From: Ryan Li Date: Sat, 20 Apr 2024 12:14:59 -0400 Subject: [PATCH 1/2] deploy to firebase --- .../firebase-hosting-pull-request.yml | 20 +++++++++++++++++++ firebase.json | 13 +++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/firebase-hosting-pull-request.yml diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml new file mode 100644 index 0000000..2a4326f --- /dev/null +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -0,0 +1,20 @@ +# 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 +permissions: + checks: write + contents: read + pull-requests: write +jobs: + build_and_preview: + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: ${{ secrets.GITHUB_TOKEN }} + firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_PLAYLIST_VIEW_SORTER }} + projectId: playlist-view-sorter diff --git a/firebase.json b/firebase.json index 172cf4c..c2d7f42 100644 --- a/firebase.json +++ b/firebase.json @@ -1,7 +1,11 @@ { "hosting": { "public": "build/", - "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], "rewrites": [ { "source": "**", @@ -10,12 +14,15 @@ ] }, "functions": { - "predeploy": ["npm --prefix \"$RESOURCE_DIR\" run lint"], + "predeploy": [ + "npm --prefix \"$RESOURCE_DIR\" run lint" + ], "rewrites": [ { "source": "**", "function": "app" } - ] + ], + "source": "functions" } } From bb6316807244892f238fe2940f74dd7ce5672024 Mon Sep 17 00:00:00 2001 From: Ryan Li Date: Sat, 20 Apr 2024 12:19:12 -0400 Subject: [PATCH 2/2] build --- .github/workflows/firebase-hosting-pull-request.yml | 5 +++++ firebase.json | 10 ++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 2a4326f..dcf776d 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -13,6 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + - run: npm install + - run: npm run build - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/firebase.json b/firebase.json index c2d7f42..5a89274 100644 --- a/firebase.json +++ b/firebase.json @@ -1,11 +1,7 @@ { "hosting": { "public": "build/", - "ignore": [ - "firebase.json", - "**/.*", - "**/node_modules/**" - ], + "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], "rewrites": [ { "source": "**", @@ -14,9 +10,7 @@ ] }, "functions": { - "predeploy": [ - "npm --prefix \"$RESOURCE_DIR\" run lint" - ], + "predeploy": ["npm --prefix \"$RESOURCE_DIR\" run lint"], "rewrites": [ { "source": "**",