Skip to content

Commit 893f06c

Browse files
TaiSakumaclaude
andcommitted
refactor: pass site-dir between actions and use mv for built site
- Add site-dir output to build-docs action - Add site-dir input to deploy-to-gh-pages action - Use mv instead of cp for built site - Move touch .nojekyll next to git add Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0fafff2 commit 893f06c

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

.github/actions/build-docs/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ inputs:
66
description: Subdirectory to deploy to (e.g., dev, 1.0.0, pr/3)
77
required: true
88

9+
outputs:
10+
site-dir:
11+
description: Path to the built site
12+
value: /tmp/built-site
13+
914
runs:
1015
using: composite
1116
steps:
1217
- shell: bash
1318
run: |
1419
uv run --group docs python .github/scripts/override_site_url.py "${{ inputs.subdir }}"
1520
uv run --group docs zensical build --clean
16-
cp -r site /tmp/built-site
21+
mv site /tmp/built-site
1722
git checkout -- zensical.toml

.github/actions/deploy-to-gh-pages/action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Deploy to gh-pages
22
description: Deploy built docs to a subdirectory on gh-pages
33

44
inputs:
5+
site-dir:
6+
description: Path to the built site
7+
required: true
58
target:
69
description: Subdirectory to deploy to
710
required: true
@@ -31,10 +34,10 @@ runs:
3134
git rm -rf .
3235
git clean -fd
3336
fi
34-
touch .nojekyll
3537
rm -rf "$TARGET"
3638
mkdir -p "$(dirname "$TARGET")"
37-
cp -r /tmp/built-site "$TARGET"
39+
cp -r "${{ inputs.site-dir }}" "$TARGET"
40+
touch .nojekyll
3841
git add .nojekyll "$TARGET"
3942
git diff --cached --quiet || git commit -m "${{ inputs.commit-message }}"
4043
git push origin gh-pages

.github/workflows/docs-pr-preview.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ jobs:
2121
- uses: astral-sh/setup-uv@v7
2222

2323
- uses: ./.github/actions/build-docs
24+
id: build
2425
with:
2526
subdir: pr/${{ github.event.number }}
2627

2728
- uses: ./.github/actions/deploy-to-gh-pages
2829
id: deploy
2930
with:
31+
site-dir: ${{ steps.build.outputs.site-dir }}
3032
target: pr/${{ github.event.number }}
3133
commit-message: "Deploy PR #${{ github.event.number }} preview"
3234

.github/workflows/docs-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,21 @@ jobs:
3232
- uses: astral-sh/setup-uv@v7
3333

3434
- uses: ./.github/actions/build-docs
35+
id: build
3536
with:
3637
subdir: ${{ steps.version.outputs.version }}
3738

3839
- uses: ./.github/actions/deploy-to-gh-pages
3940
with:
41+
site-dir: ${{ steps.build.outputs.site-dir }}
4042
target: ${{ steps.version.outputs.version }}
4143
commit-message: Deploy docs for v${{ steps.version.outputs.version }}
4244

4345
- name: Update latest and index.html
4446
run: |
4547
TARGET="${{ steps.version.outputs.version }}"
4648
rm -rf latest
47-
cp -r /tmp/built-site latest
49+
cp -r "${{ steps.build.outputs.site-dir }}" latest
4850
# Generate root index.html
4951
REPO_NAME="${{ github.event.repository.name }}"
5052
{

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ jobs:
2121
- uses: astral-sh/setup-uv@v7
2222

2323
- uses: ./.github/actions/build-docs
24+
id: build
2425
with:
2526
subdir: dev
2627

2728
- uses: ./.github/actions/deploy-to-gh-pages
2829
with:
30+
site-dir: ${{ steps.build.outputs.site-dir }}
2931
target: dev
3032
commit-message: Deploy dev docs

0 commit comments

Comments
 (0)