From e233f402e8be8ad8e682c6c1ef1afde61e71cb72 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 8 Mar 2024 16:01:38 +0100 Subject: [PATCH 1/3] Tweak --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c54da4186f5..525d051409f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,7 +5,7 @@ on: - main workflow_dispatch: concurrency: - group: staging + group: ${{ github.workflow }} cancel-in-progress: true jobs: deploy: From f77973e241ff54b394ed9d59cba7e88fba130072 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 8 Mar 2024 16:04:04 +0100 Subject: [PATCH 2/3] Add CI for deploying pull request previews --- .github/workflows/pr-preview.yml | 42 ++++++++++++++++++++++++++++++++ docusaurus.config.ts | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-preview.yml diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml new file mode 100644 index 00000000000..10ef75d008e --- /dev/null +++ b/.github/workflows/pr-preview.yml @@ -0,0 +1,42 @@ +name: Deploy pull request preview +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed +concurrency: preview-${{ github.ref }} +jobs: + pr-preview: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + submodules: true + # Build the website + - name: Use Node.js 20 + if: github.event.action != 'closed' + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + - name: Build + if: github.event.action != 'closed' + run: | + npm ci + npm run build + env: + THEOPLAYER_LICENSE: ${{ vars.THEOPLAYER_LICENSE }} + # Preview URLs look like this: https://[owner].github.io/[repo]/pr-preview/pr-[number]/ + # https://github.com/marketplace/actions/deploy-pr-preview + DOCUSAURUS_BASE_URL: /${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.number }}/ + # Deploy preview + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./build/ + preview-branch: gh-pages + umbrella-dir: pr-preview diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 23e5d453528..20679a2c1dd 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -46,7 +46,7 @@ const config: Config = { url: 'https://theoplayer.prudentgiraffe.com/', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: '/docs/', + baseUrl: process.env.DOCUSAURUS_BASE_URL || '/docs/', trailingSlash: true, // GitHub pages deployment config. From b079c719b39a3da9ffe112faccf30e51b8904b31 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 8 Mar 2024 16:32:06 +0100 Subject: [PATCH 3/3] Prevent PR previews from being indexed by search engines --- .github/workflows/pr-preview.yml | 2 ++ docusaurus.config.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 10ef75d008e..5cf90663051 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -33,6 +33,8 @@ jobs: # Preview URLs look like this: https://[owner].github.io/[repo]/pr-preview/pr-[number]/ # https://github.com/marketplace/actions/deploy-pr-preview DOCUSAURUS_BASE_URL: /${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.number }}/ + # Prevent PR previews from being indexed by search engines + DOCUSAURUS_NO_INDEX: 1 # Deploy preview - name: Deploy preview uses: rossjrw/pr-preview-action@v1 diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 20679a2c1dd..f7da033499d 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -48,6 +48,7 @@ const config: Config = { // For GitHub pages deployment, it is often '//' baseUrl: process.env.DOCUSAURUS_BASE_URL || '/docs/', trailingSlash: true, + noIndex: !!process.env.DOCUSAURUS_NO_INDEX, // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these.