Skip to content

Commit 1c98007

Browse files
authored
Always upload artifact with built website (#73)
This way we can preview the website in a PR, without having to build it locally. Build website without setting `BASE_URL` when it's done within a PR, so the built site can be previewed locally without path issues.
1 parent 8d34d86 commit 1c98007

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,24 @@ jobs:
3232
- name: Print MyST version
3333
run: myst --version
3434

35-
- name: Build website as static HTML
35+
- name: Build website as static HTML (for PR)
36+
if: github.event_name == 'pull_request'
37+
run: |
38+
echo "Building MyST website without setting BASE_URL"
39+
myst build --html
40+
41+
- name: Build website as static HTML (for deploy)
42+
if: github.event_name != 'pull_request'
3643
run: |
3744
echo "Building MyST website using BASE_URL=" $BASE_URL
3845
myst build --html
3946
env:
4047
BASE_URL: /${{ github.event.repository.name }}
4148

4249
# Store the website as a build artifact so we can deploy it later
50+
# or preview the website in a PR.
4351
- name: Upload HTML website as an artifact
44-
# Only if not a pull request
45-
if: success() && github.event_name != 'pull_request'
52+
if: success()
4653
uses: actions/upload-artifact@v4
4754
with:
4855
name: html-${{ github.sha }}

0 commit comments

Comments
 (0)