Skip to content

Commit a253e84

Browse files
committed
fix: add git user/email and allow manual trigger for docs pipeline
1 parent 32515ba commit a253e84

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

.github/workflows/build-docs.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Build docs
22
on:
3+
workflow_dispatch:
34
release:
45
types:
56
- published
@@ -29,11 +30,38 @@ jobs:
2930
with:
3031
name: notebooks
3132
path: docs/notebooks
32-
- name: Extract version from release
33+
- name: Find the latest existing release tag
34+
id: get_release
35+
run: |
36+
if [ "${{ github.event_name }}" == "release" ]; then
37+
LATEST_TAG="${{ github.event.release.tag_name }}"
38+
else
39+
echo "::notice::Running manually via workflow_dispatch. Fetching latest release tag..."
40+
41+
gh auth status || echo "GitHub CLI is not authenticated, relying on GITHUB_TOKEN."
42+
43+
# We use tr -d '\n' to remove the trailing newline for a clean tag string
44+
LATEST_TAG=$(gh release view --json tagName -q .tagName 2>/dev/null)
45+
46+
if [ -z "$LATEST_TAG" ]; then
47+
echo "::error::Could not find the latest published release tag. Ensure a release exists."
48+
exit 1
49+
fi
50+
fi
51+
52+
echo "Latest release tag found: $LATEST_TAG"
53+
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
- name: Extract version from release tag
3357
run: |
3458
# Remove the 'v' prefix and any suffix after a space
35-
VERSION=$(echo ${{ github.event.release.tag_name }} | sed 's/^v//' | sed 's/ .*$//')
59+
VERSION=$(echo ${{ env.LATEST_TAG }} | sed 's/^v//' | sed 's/ .*$//')
3660
echo "::notice::Extracted version: $VERSION"
3761
echo "VERSION=$VERSION" >> $GITHUB_ENV
62+
- name: Setup doc deploy
63+
run: |
64+
git config --global user.name "github-actions[bot]"
65+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
3866
- name: Build and deploy docs
3967
run: uv run mike deploy --push --update-aliases ${{ env.VERSION }} latest

0 commit comments

Comments
 (0)