From c267d4e09186c8257390fbf64e3ac2a40ec43c46 Mon Sep 17 00:00:00 2001 From: Adithya Vardhan Date: Wed, 5 Jan 2022 09:42:57 +0530 Subject: [PATCH 1/3] add: workflow --- .firebaserc | 5 +++++ .github/workflows/firebase-hosting-merge.yml | 20 +++++++++++++++++++ .../firebase-hosting-pull-request.yml | 17 ++++++++++++++++ firebase.json | 16 +++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 .firebaserc create mode 100644 .github/workflows/firebase-hosting-merge.yml create mode 100644 .github/workflows/firebase-hosting-pull-request.yml create mode 100644 firebase.json diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 0000000..dd8f7b9 --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "checktober" + } +} diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml new file mode 100644 index 0000000..b36835c --- /dev/null +++ b/.github/workflows/firebase-hosting-merge.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 merge +'on': + push: + branches: + - main +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm ci && npm run build + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_CHECKTOBER }}' + channelId: live + projectId: checktober diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml new file mode 100644 index 0000000..714199b --- /dev/null +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -0,0 +1,17 @@ +# 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 +jobs: + build_and_preview: + if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm ci && npm run build + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_CHECKTOBER }}' + projectId: checktober diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..340ed5b --- /dev/null +++ b/firebase.json @@ -0,0 +1,16 @@ +{ + "hosting": { + "public": "build", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } +} From f714022bc7bf2d040fa50c9aa3ec1207fbd0facc Mon Sep 17 00:00:00 2001 From: Adithya Vardhan Date: Wed, 5 Jan 2022 10:07:58 +0530 Subject: [PATCH 2/3] add: env to actions --- .github/workflows/firebase-hosting-merge.yml | 2 ++ .github/workflows/firebase-hosting-pull-request.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index b36835c..beff70b 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -12,6 +12,8 @@ jobs: steps: - uses: actions/checkout@v2 - run: npm ci && npm run build + env: + REACT_APP_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 714199b..467acc2 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -10,6 +10,8 @@ jobs: steps: - uses: actions/checkout@v2 - run: npm ci && npm run build + env: + REACT_APP_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' From 2827248d352fde50198324b20ce4f4811112c4df Mon Sep 17 00:00:00 2001 From: Adithya Vardhan Date: Wed, 5 Jan 2022 10:22:55 +0530 Subject: [PATCH 3/3] refactor: rename env --- .github/workflows/firebase-hosting-merge.yml | 2 +- .github/workflows/firebase-hosting-pull-request.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index beff70b..8b9f32d 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v2 - run: npm ci && npm run build env: - REACT_APP_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + REACT_APP_GITHUB_TOKEN: '${{ secrets.REACT_APP_GITHUB_TOKEN }}' - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 467acc2..b6db85c 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v2 - run: npm ci && npm run build env: - REACT_APP_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + REACT_APP_GITHUB_TOKEN: '${{ secrets.REACT_APP_GITHUB_TOKEN }}' - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}'