Skip to content

Commit a31f1b1

Browse files
feat(docs): handle pull request builds
Continues 5214240
1 parent 57816a3 commit a31f1b1

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

.github/workflows/docs.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ on:
1717
description: Whether to publish artifacts in a new release.
1818
default: false
1919
type: boolean
20+
pull_request:
21+
paths:
22+
- .github/workflows/docs.yaml
2023

2124
# This workflow cannot share caches with typst.yaml, because x86_64-unknown-linux-gnu ≠ x86_64-unknown-linux-musl.
2225

@@ -26,12 +29,15 @@ jobs:
2629
runs-on: ubuntu-latest
2730
permissions:
2831
contents: write
29-
32+
env:
33+
INPUT_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || 'main' }}
34+
INPUT_DOCS_BASE: ${{ github.event_name == 'workflow_dispatch' && inputs.docs_base || '/DOCS-BASE/' }}
35+
INPUT_RELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.release || false }}
3036
steps:
3137
- uses: actions/checkout@v6
3238
with:
3339
repository: typst/typst
34-
ref: ${{ github.event.inputs.ref }}
40+
ref: ${{ env.INPUT_REF }}
3541

3642
- uses: actions/checkout@v6
3743
with:
@@ -59,7 +65,7 @@ jobs:
5965
6066
- name: Build docs
6167
run: |
62-
cargo run --package typst-docs --release -- --assets-dir assets/ --out-file docs.json --base "${{ github.event.inputs.docs_base }}"
68+
cargo run --package typst-docs --release -- --assets-dir assets/ --out-file docs.json --base "${{ env.INPUT_DOCS_BASE }}"
6369
6470
- name: Prepare to upload
6571
shell: bash
@@ -80,7 +86,7 @@ jobs:
8086
archive: false
8187

8288
- uses: softprops/action-gh-release@v2
83-
if: ${{ inputs.release }}
89+
if: ${{ env.INPUT_RELEASE == 'true' }}
8490
env:
8591
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8692
with:
@@ -92,6 +98,6 @@ jobs:
9298
docs.json
9399
docs-assets.zip
94100
- name: Report the release
95-
if: ${{ inputs.release }}
101+
if: ${{ env.INPUT_RELEASE == 'true' }}
96102
run: |
97103
echo "Please publish the [draft release](https://github.com/typst-community/dev-builds/releases)." >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)