From 26e5b234bca526405beb358ebb52d778de7cfd7f Mon Sep 17 00:00:00 2001 From: Oseer Williams Date: Tue, 30 Apr 2024 12:15:42 -0400 Subject: [PATCH 1/6] build(): Adding PR previews --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ .github/workflows/deploy.yml | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..a07303265e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: CI +on: + workflow_dispatch: + pull_request: + types: [opened, edited, reopened, closed, synchronize] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + cache: npm + - name: Install dependencies + run: npx ci + - name: Build docusaurus artifacts + run: npm run build + - name: PR Number + run: echo "PR-${{ github.event.pull_request.number }}" + - name: Deploy PR Preview + uses: rossjrw/pr-preview-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + preview-branch: gh-pages + source-dir: ./build/ + umbrella-dir: pr-preview \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 155919467f..ee6d8ac577 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,7 +34,7 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v4 - name: Use Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: cache: npm - name: Install dependencies From 17aabb1f5b86848d18786229968f93e2316ad43f Mon Sep 17 00:00:00 2001 From: Oseer Williams Date: Tue, 30 Apr 2024 12:20:46 -0400 Subject: [PATCH 2/6] build(): Adding PR previews --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a07303265e..d02ee1d17f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - name: Deploy PR Preview uses: rossjrw/pr-preview-action@v1 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GH_TOKEN }} preview-branch: gh-pages source-dir: ./build/ umbrella-dir: pr-preview \ No newline at end of file From af0f63216785f2d5b25ad817b4f3baa4c165c5c0 Mon Sep 17 00:00:00 2001 From: Oseer Williams Date: Tue, 30 Apr 2024 12:25:38 -0400 Subject: [PATCH 3/6] adding concurrency to ci run --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d02ee1d17f..5f3cee0b8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,14 @@ name: CI + on: workflow_dispatch: pull_request: types: [opened, edited, reopened, closed, synchronize] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest From c6b8ef0503ee9af095d09a8c28d8da7fdac6219a Mon Sep 17 00:00:00 2001 From: Oseer Williams Date: Wed, 15 May 2024 08:57:52 -0400 Subject: [PATCH 4/6] build(previews): adjusting CI config --- .github/workflows/ci.yml | 2 +- docusaurus.config.ci.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 docusaurus.config.ci.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f3cee0b8a..1f3160dce1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - name: Install dependencies run: npx ci - name: Build docusaurus artifacts - run: npm run build + run: npm run build -- --locale en --config ./docusaurus.config.ci.js - name: PR Number run: echo "PR-${{ github.event.pull_request.number }}" - name: Deploy PR Preview diff --git a/docusaurus.config.ci.js b/docusaurus.config.ci.js new file mode 100644 index 0000000000..618397eccd --- /dev/null +++ b/docusaurus.config.ci.js @@ -0,0 +1,9 @@ +import config from './docusaurus.config'; + +/** @type {import('@docusaurus/types').Config} */ +const prConfig = { + ...config, + noIndex: true, +}; + +export default prConfig; From 16526a4531138390ddfda296ba93f88244c8a255 Mon Sep 17 00:00:00 2001 From: Oseer Williams Date: Wed, 15 May 2024 09:30:00 -0400 Subject: [PATCH 5/6] fix(pr): set base pr review url --- .github/workflows/ci.yml | 4 +++- docusaurus.config.ci.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f3160dce1..7282a6155b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,9 @@ jobs: - name: Install dependencies run: npx ci - name: Build docusaurus artifacts - run: npm run build -- --locale en --config ./docusaurus.config.ci.js + env: + GH_PR_NUMBER: ${{ github.event.pull_request.number }} + run: npm run build -- --locale en --config ./docusaurus.config.ci.js - name: PR Number run: echo "PR-${{ github.event.pull_request.number }}" - name: Deploy PR Preview diff --git a/docusaurus.config.ci.js b/docusaurus.config.ci.js index 618397eccd..14e26c4c37 100644 --- a/docusaurus.config.ci.js +++ b/docusaurus.config.ci.js @@ -4,6 +4,7 @@ import config from './docusaurus.config'; const prConfig = { ...config, noIndex: true, + baseUrl: `${config.baseUrl}/pr-previews/pr-${process.env.GH_PR_NUMBER}` }; export default prConfig; From 52a1765cc2cd42fd06a08f8dfd84d106eedac85b Mon Sep 17 00:00:00 2001 From: Oseer Williams Date: Wed, 15 May 2024 09:38:44 -0400 Subject: [PATCH 6/6] fix(pr): preview url --- docusaurus.config.ci.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.ci.js b/docusaurus.config.ci.js index 14e26c4c37..6f90699e85 100644 --- a/docusaurus.config.ci.js +++ b/docusaurus.config.ci.js @@ -4,7 +4,7 @@ import config from './docusaurus.config'; const prConfig = { ...config, noIndex: true, - baseUrl: `${config.baseUrl}/pr-previews/pr-${process.env.GH_PR_NUMBER}` + baseUrl: `${config.baseUrl}/pr-preview/pr-${process.env.GH_PR_NUMBER}` }; export default prConfig;