From 3a414dac5979be11531d862f2a568e2e86380f56 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 11:54:53 -0600 Subject: [PATCH 01/15] Deploy to cloudflare pages on push --- .github/workflows/deployExpensifyHelp.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index ca7345ef9462..4a2583447885 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -2,9 +2,7 @@ name: Deploy ExpensifyHelp on: - # Runs on pushes targeting the default branch push: - branches: ["main"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -49,8 +47,20 @@ jobs: with: path: ./docs/_site + - name: Preview on Cloudflare Pages + if: github.ref != 'refs/heads/main' + uses: cloudflare/pages-action@v1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} + directory: ./docs/_site + # Optional: Enable this if you want to have GitHub Deployments triggered + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + # Deployment job deploy: + if: github.ref == 'refs/heads/main' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} From 06e059d5bd43465c582b8e8a5865790856e62f63 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 12:14:37 -0600 Subject: [PATCH 02/15] Update with project name, clean up unused --- .github/workflows/deployExpensifyHelp.yml | 27 +---------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index 4a2583447885..0905c6992110 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -1,10 +1,7 @@ -# Deploying the ExpensifyHelp Jekyll site by dynamically generating routes file name: Deploy ExpensifyHelp on: push: - - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages @@ -30,9 +27,6 @@ jobs: - name: Setup NodeJS uses: Expensify/App/.github/actions/composite/setupNode@main - - name: Setup Pages - uses: actions/configure-pages@f156874f8191504dae5b037505266ed5dda6c382 - - name: Create docs routes file run: ./.github/scripts/createDocsRoutes.sh @@ -42,31 +36,12 @@ jobs: source: ./docs/ destination: ./docs/_site - - name: Upload artifact - uses: actions/upload-pages-artifact@64bcae551a7b18bcb9a09042ddf1960979799187 - with: - path: ./docs/_site - - name: Preview on Cloudflare Pages if: github.ref != 'refs/heads/main' uses: cloudflare/pages-action@v1 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} + projectName: helpdot directory: ./docs/_site - # Optional: Enable this if you want to have GitHub Deployments triggered gitHubToken: ${{ secrets.GITHUB_TOKEN }} - - # Deployment job - deploy: - if: github.ref == 'refs/heads/main' - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@af48cf94a42f2c634308b1c9dc0151830b6f190a From d78bdc14113e4b6aee06d68b50010bc2ef35627c Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 12:15:28 -0600 Subject: [PATCH 03/15] Remove main check --- .github/workflows/deployExpensifyHelp.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index 0905c6992110..45d09d513ab2 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -37,7 +37,6 @@ jobs: destination: ./docs/_site - name: Preview on Cloudflare Pages - if: github.ref != 'refs/heads/main' uses: cloudflare/pages-action@v1 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} From 8318ee924a9cc67dd61cd3fec90a3e7077fdef37 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 12:17:40 -0600 Subject: [PATCH 04/15] Update to `CLOUDFLARE_TOKEN` --- .github/workflows/deployExpensifyHelp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index 45d09d513ab2..0538ab9f53d1 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -39,7 +39,7 @@ jobs: - name: Preview on Cloudflare Pages uses: cloudflare/pages-action@v1 with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + apiToken: ${{ secrets.CLOUDFLARE_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: helpdot directory: ./docs/_site From b03f5b5882b917ccfdf2fffa9669bf85938787fe Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 12:40:30 -0600 Subject: [PATCH 05/15] Use new token --- .github/workflows/deployExpensifyHelp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index 0538ab9f53d1..0fdd3353485f 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -36,10 +36,10 @@ jobs: source: ./docs/ destination: ./docs/_site - - name: Preview on Cloudflare Pages + - name: Deploy to Cloudflare Pages uses: cloudflare/pages-action@v1 with: - apiToken: ${{ secrets.CLOUDFLARE_TOKEN }} + apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: helpdot directory: ./docs/_site From 73457a07f31c8d1d7c655263dc1422bd69781b86 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 12:42:36 -0600 Subject: [PATCH 06/15] Remove github token as we don't need it --- .github/workflows/deployExpensifyHelp.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index 0fdd3353485f..fcfcc6929e07 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -43,4 +43,3 @@ jobs: accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: helpdot directory: ./docs/_site - gitHubToken: ${{ secrets.GITHUB_TOKEN }} From 52ad144fe4386756d2f46aa98424caa86c9924c1 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 12:48:09 -0600 Subject: [PATCH 07/15] Remove unused token permissions --- .github/workflows/deployExpensifyHelp.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index fcfcc6929e07..c33e49038db1 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -4,12 +4,6 @@ on: push: workflow_dispatch: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: @@ -17,7 +11,6 @@ concurrency: cancel-in-progress: false jobs: - # Build job build: runs-on: ubuntu-latest steps: From 2e8f233f92e4ad4c0c0bfe80b78cf3bcf4cca0a1 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 12:48:38 -0600 Subject: [PATCH 08/15] Pin to commit as it uses a token --- .github/workflows/deployExpensifyHelp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index c33e49038db1..f25be8ee17b0 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -30,7 +30,7 @@ jobs: destination: ./docs/_site - name: Deploy to Cloudflare Pages - uses: cloudflare/pages-action@v1 + uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca with: apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} From e34b91232364b54938bcb7010c02b55f1b537c19 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 14:13:58 -0600 Subject: [PATCH 09/15] Add a bit more logic on trigger and commenting --- .github/workflows/deployExpensifyHelp.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index f25be8ee17b0..af8577ec7702 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -1,7 +1,21 @@ name: Deploy ExpensifyHelp on: + # Run on any push to main that has changes to the docs directory push: + branches: + - main + paths: + - 'docs/**' + + # Run on any pull request (except PRs against staging or production) that has changes to the docs directory + pull_request: + types: [opened, synchronize] + branches-ignore: [staging, production] + paths: + - 'docs/**' + + # Run on any manual trigger workflow_dispatch: # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. @@ -31,8 +45,16 @@ jobs: - name: Deploy to Cloudflare Pages uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca + id: deploy with: apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: helpdot directory: ./docs/_site + + - name: Leave a comment on the PR + uses: actions-cool/maintain-one-comment@de04bd2a3750d86b324829a3ff34d47e48e16f4b + if: ${{ github.event_name == 'pull_request' }} + with: + token: ${{ secrets.OS_BOTIFY_TOKEN }} + body: format('Preview deployed to {0}', steps.deploy.outputs.url) From e61b148e8b77e72ac3a14829db9946b96b218b07 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 14:14:48 -0600 Subject: [PATCH 10/15] Add change to docs to test --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 5fb3c2883c52..1aa32dacf067 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# Welcome to the Expensify Help site +# Welcome to the Expensify Help site 🤠 [Expensify Help](https://help.expensify.com/) is mainly composed of static HTML (`.html`) and Markdown (`.md`) files. We use [Jekyll](https://jekyllrb.com/) to generate a static site from those HTML and Markdown files. From 6bceffe7695274c90de806d3676ef201b64b4d8e Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 14:17:17 -0600 Subject: [PATCH 11/15] Unfurl? --- .github/workflows/deployExpensifyHelp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index af8577ec7702..9c18f44a82c5 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -57,4 +57,4 @@ jobs: if: ${{ github.event_name == 'pull_request' }} with: token: ${{ secrets.OS_BOTIFY_TOKEN }} - body: format('Preview deployed to {0}', steps.deploy.outputs.url) + body: ${{ format('Preview deployed to {0}', steps.deploy.outputs.url) }} From 1c466d2ca1f619af3e9808c117c73542a8471283 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 14:19:57 -0600 Subject: [PATCH 12/15] Update message once again --- .github/workflows/deployExpensifyHelp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index 9c18f44a82c5..d4a360f7237d 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -57,4 +57,4 @@ jobs: if: ${{ github.event_name == 'pull_request' }} with: token: ${{ secrets.OS_BOTIFY_TOKEN }} - body: ${{ format('Preview deployed to {0}', steps.deploy.outputs.url) }} + body: ${{ format('A preview of your ExpensifyHelp changes have been deployed to {0} ⚡️', steps.deploy.outputs.url) }} From 8a6fe5453f87ae53f7eb345b49cd98d7fad2f32f Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 19 Oct 2023 14:24:28 -0600 Subject: [PATCH 13/15] Test that job does not run when no changes to docs/ --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 1aa32dacf067..5fb3c2883c52 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# Welcome to the Expensify Help site 🤠 +# Welcome to the Expensify Help site [Expensify Help](https://help.expensify.com/) is mainly composed of static HTML (`.html`) and Markdown (`.md`) files. We use [Jekyll](https://jekyllrb.com/) to generate a static site from those HTML and Markdown files. From 052f707bbe4cde30ce299c9fc1ff4530caf0641f Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 20 Oct 2023 10:32:43 -0600 Subject: [PATCH 14/15] Test alias --- .github/workflows/deployExpensifyHelp.yml | 2 +- docs/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployExpensifyHelp.yml b/.github/workflows/deployExpensifyHelp.yml index d4a360f7237d..4a53e75354c6 100644 --- a/.github/workflows/deployExpensifyHelp.yml +++ b/.github/workflows/deployExpensifyHelp.yml @@ -57,4 +57,4 @@ jobs: if: ${{ github.event_name == 'pull_request' }} with: token: ${{ secrets.OS_BOTIFY_TOKEN }} - body: ${{ format('A preview of your ExpensifyHelp changes have been deployed to {0} ⚡️', steps.deploy.outputs.url) }} + body: ${{ format('A preview of your ExpensifyHelp changes have been deployed to {0} ⚡️', steps.deploy.outputs.alias) }} diff --git a/docs/README.md b/docs/README.md index 5fb3c2883c52..1aa32dacf067 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# Welcome to the Expensify Help site +# Welcome to the Expensify Help site 🤠 [Expensify Help](https://help.expensify.com/) is mainly composed of static HTML (`.html`) and Markdown (`.md`) files. We use [Jekyll](https://jekyllrb.com/) to generate a static site from those HTML and Markdown files. From ab8f3bca9ff627b7d7ece9a9ce1d3768be6d5ca0 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 20 Oct 2023 10:35:21 -0600 Subject: [PATCH 15/15] Undo test --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 1aa32dacf067..5fb3c2883c52 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# Welcome to the Expensify Help site 🤠 +# Welcome to the Expensify Help site [Expensify Help](https://help.expensify.com/) is mainly composed of static HTML (`.html`) and Markdown (`.md`) files. We use [Jekyll](https://jekyllrb.com/) to generate a static site from those HTML and Markdown files.