Skip to content

Commit fcf1b34

Browse files
authored
Fix broken Docusaurus preview links (#7185)
1 parent e0d39f7 commit fcf1b34

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

.github/workflows/docusaurus-site.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,34 @@ jobs:
3030
uses: actions/checkout@main
3131

3232
- name: Build Site
33+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
3334
working-directory: doc/docusaurus
3435
run: nix develop --no-warn-dirty --accept-flake-config --command bash -c 'yarn && yarn build'
3536

36-
- name: Deploy Preview
37-
if: github.event_name == 'pull_request' && github.event.action != 'closed'
38-
uses: rossjrw/pr-preview-action@v1
39-
with:
40-
source-dir: doc/docusaurus/build
41-
4237
- name: Deploy Site
4338
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
4439
uses: JamesIves/[email protected]
4540
with:
4641
folder: doc/docusaurus/build
4742
target-folder: docs
4843
single-commit: true
44+
45+
- name: Build Preview Site
46+
if: github.event_name == 'pull_request' && github.event.action != 'closed'
47+
working-directory: doc/docusaurus
48+
run: |
49+
PR_NUMBER="${{ github.event.pull_request.number }}"
50+
# These match the URL expected by rossjrw/pr-preview-action@v1:
51+
export DOCUSAURUS_URL="https://plutus.cardano.intersectmbo.org"
52+
export DOCUSAURUS_BASE_URL="/pr-preview/pr-${PR_NUMBER}"
53+
nix develop --no-warn-dirty --accept-flake-config --command bash -c 'yarn && yarn build'
54+
55+
- name: Deploy Preview Site
56+
if: github.event_name == 'pull_request' && github.event.action != 'closed'
57+
uses: rossjrw/pr-preview-action@v1
58+
with:
59+
source-dir: doc/docusaurus/build
60+
61+
62+
63+

doc/docusaurus/docusaurus.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const config: Config = {
88
favicon: "img/favicon.ico",
99

1010
// Set the production url of your site here
11-
url: "https://plutus.cardano.intersectmbo.org",
11+
url: process.env.DOCUSAURUS_URL || "https://plutus.cardano.intersectmbo.org",
1212

1313
// Set the /<baseUrl>/ pathname under which your site is served
1414
// For GitHub pages deployment, it is often '/<projectName>/'
15-
baseUrl: "/docs/",
15+
baseUrl: process.env.DOCUSAURUS_BASE_URL || "/docs/",
1616

1717
// GitHub pages deployment config.
1818
// If you aren't using GitHub pages, you don't need these.

0 commit comments

Comments
 (0)