From 0ec4c68c7c96410e28d0c12690dcaa05e3b323aa Mon Sep 17 00:00:00 2001 From: MrCoder Date: Thu, 2 Nov 2023 18:19:03 +1100 Subject: [PATCH 1/3] Added firebase deployment workflow. https://firebase.google.com/docs/hosting/github-integration --- .firebaserc | 2 +- .github/workflows/firebase-hosting-merge.yml | 22 +++++++++++++++++++ .../firebase-hosting-pull-request.yml | 18 +++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/firebase-hosting-merge.yml create mode 100644 .github/workflows/firebase-hosting-pull-request.yml diff --git a/.firebaserc b/.firebaserc index 21d47aa4..bc8cc02e 100644 --- a/.firebaserc +++ b/.firebaserc @@ -4,4 +4,4 @@ "staging": "staging-zenuml-27954", "prod": "web-sequence-local" } -} \ No newline at end of file +} diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml new file mode 100644 index 00000000..4123ef68 --- /dev/null +++ b/.github/workflows/firebase-hosting-merge.yml @@ -0,0 +1,22 @@ +# 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: + - master +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: yarn install && yarn build + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_STAGING_ZENUML_27954 }}' + channelId: live + projectId: staging-zenuml-27954 + env: + FIREBASE_CLI_PREVIEWS: hostingchannels diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml new file mode 100644 index 00000000..1305fdf6 --- /dev/null +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -0,0 +1,18 @@ +# 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: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: yarn install && yarn build + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_STAGING_ZENUML_27954 }}' + projectId: staging-zenuml-27954 + env: + FIREBASE_CLI_PREVIEWS: hostingchannels From f49d9f56d7d819baaebae8d4872225b05433d0bb Mon Sep 17 00:00:00 2001 From: MrCoder Date: Thu, 2 Nov 2023 18:25:27 +1100 Subject: [PATCH 2/3] Add `yarn release` to create `app` folder. --- .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 4123ef68..8a22a436 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: yarn install && yarn build + - run: yarn install && yarn build && yarn release - 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 1305fdf6..d3b90582 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: yarn install && yarn build + - run: yarn install && yarn build && yarn release - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' From 9185cd4ba4b5f28d4a822aabb2a6e3f1e90c2312 Mon Sep 17 00:00:00 2001 From: MrCoder Date: Thu, 2 Nov 2023 19:13:50 +1100 Subject: [PATCH 3/3] Removed deploy-staging.yml. Use firebase-hosting-merge-staging.yml and firebase-hosting-pull-request.yml. --- .github/workflows/deploy-staging.yml | 32 ------------------- ...yml => firebase-hosting-merge-staging.yml} | 0 ...firebase-hosting-pull-request-staging.yml} | 0 3 files changed, 32 deletions(-) delete mode 100644 .github/workflows/deploy-staging.yml rename .github/workflows/{firebase-hosting-merge.yml => firebase-hosting-merge-staging.yml} (100%) rename .github/workflows/{firebase-hosting-pull-request.yml => firebase-hosting-pull-request-staging.yml} (100%) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml deleted file mode 100644 index 0b030007..00000000 --- a/.github/workflows/deploy-staging.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Deploy to Stage - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - run: yarn install && yarn build - - run: yarn release - - name: Deploy to staging - if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' # This conditional will skip the step for Dependabot PRs - run: yarn deploy:staging --token ${{ secrets.FIREBASE_TOKEN }} - - name: Upload artifacts # Find artifacts under actions/jobs - uses: actions/upload-artifact@v3 - with: - name: chrome-extension - path: extension diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge-staging.yml similarity index 100% rename from .github/workflows/firebase-hosting-merge.yml rename to .github/workflows/firebase-hosting-merge-staging.yml diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request-staging.yml similarity index 100% rename from .github/workflows/firebase-hosting-pull-request.yml rename to .github/workflows/firebase-hosting-pull-request-staging.yml