55 tags :
66 - " v*.*.*" # Trigger on version tags like v1.0.0, v2.1.3, etc.
77
8+ # Allow manual trigger to re-run docs deployment
9+ workflow_dispatch :
10+ inputs :
11+ version :
12+ description : " Version to deploy docs for (e.g., 2.1.1)"
13+ required : true
14+ type : string
15+
816jobs :
917 build :
1018 name : Build distribution
19+ if : github.event_name != 'workflow_dispatch'
1120 runs-on : ubuntu-latest
1221 steps :
1322 - uses : actions/checkout@v4
3847
3948 publish-to-pypi :
4049 name : Publish to PyPI
41- if : startsWith(github.ref, 'refs/tags/') # Only publish on tags
50+ if : startsWith(github.ref, 'refs/tags/') && github.event_name != 'workflow_dispatch'
4251 needs : build
4352 runs-on : ubuntu-latest
4453 environment :
5968
6069 github-release :
6170 name : Create GitHub Release
71+ if : github.event_name != 'workflow_dispatch'
6272 needs : publish-to-pypi
6373 runs-on : ubuntu-latest
6474 permissions :
91101
92102 deploy-versioned-docs :
93103 name : Deploy versioned documentation
104+ if : always() && (needs.github-release.result == 'success' || github.event_name == 'workflow_dispatch')
94105 needs : github-release
95106 runs-on : ubuntu-latest
96107 permissions :
@@ -117,10 +128,16 @@ jobs:
117128 - name : Build documentation
118129 run : ./scripts/build_docs.sh
119130
120- - name : Extract version from tag
131+ - name : Extract version from tag or input
121132 id : version
122133 run : |
123- VERSION=${GITHUB_REF#refs/tags/v}
134+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
135+ VERSION="${{ inputs.version }}"
136+ echo "Using manually specified version: $VERSION"
137+ else
138+ VERSION=${GITHUB_REF#refs/tags/v}
139+ echo "Extracted version from tag: $VERSION"
140+ fi
124141 echo "version=$VERSION" >> $GITHUB_OUTPUT
125142
126143 - name : Generate root index.html redirect
@@ -132,6 +149,9 @@ jobs:
132149 git config user.name "github-actions[bot]"
133150 git config user.email "github-actions[bot]@users.noreply.github.com"
134151
152+ # Save the generated index.html before switching branches
153+ cp index.html /tmp/index.html
154+
135155 # Stash any local changes (e.g., uv.lock modifications from uv sync)
136156 git stash --include-untracked || true
137157
@@ -149,7 +169,7 @@ jobs:
149169 rsync -avr _build/ "$VERSION_DIR/"
150170
151171 # Update root index.html redirect to latest stable version
152- cp index.html ./
172+ cp /tmp/ index.html index.html
153173
154174 git add "$VERSION_DIR" index.html
155175 git commit -m "Deploy docs for version ${{ steps.version.outputs.version }}" || echo "No changes to commit"
0 commit comments