|
15 | 15 | name: Docs Build and Deploy |
16 | 16 |
|
17 | 17 | on: |
| 18 | + workflow_dispatch: |
| 19 | + |
18 | 20 | push: |
19 | 21 | branches: |
20 | 22 | - main |
21 | | - paths: |
22 | | - - ".github/workflows/docs.yml" |
23 | | - - "requirements-docs.txt" |
24 | | - - "mkdocs.yml" |
25 | | - - "main.py" |
26 | | - - "docs/**" |
27 | | - - "spec/**" |
| 23 | + - 'release/**' |
28 | 24 | pull_request: |
29 | 25 | branches: |
30 | 26 | - main |
@@ -112,10 +108,29 @@ jobs: |
112 | 108 | run: | |
113 | 109 | mike deploy --push draft |
114 | 110 |
|
115 | | - - name: Deploy versioned docs for tagged releases |
116 | | - if: startsWith(github.ref, 'refs/tags/') |
| 111 | + - name: Deploy release version |
| 112 | + if: startsWith(github.ref, 'refs/heads/release/') |
117 | 113 | run: | |
118 | | - TAG_NAME=${GITHUB_REF#refs/tags/} |
119 | | - mike delete latest --push |
120 | | - mike deploy --push --update-aliases $TAG_NAME latest |
| 114 | + # Extract the date (e.g., release/2026-01-11 -> 2026-01-11) |
| 115 | + VERSION_NAME=${GITHUB_REF#refs/heads/release/} |
| 116 | +
|
| 117 | + # Deploy this version, tag it as 'latest', and set it as the default site root |
| 118 | + mike deploy --push --update-aliases $VERSION_NAME latest |
121 | 119 | mike set-default --push latest |
| 120 | +
|
| 121 | + - name: Create GitHub Release and Tag |
| 122 | + if: startsWith(github.ref, 'refs/heads/release/') |
| 123 | + env: |
| 124 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 125 | + run: | |
| 126 | + VERSION_DATE=${GITHUB_REF#refs/heads/release/} |
| 127 | + TAG_NAME="v$VERSION_DATE" |
| 128 | +
|
| 129 | + # Create Release (This implicitly creates the git tag) |
| 130 | + # The '|| true' ensures the workflow doesn't fail if you |
| 131 | + # push updates to this branch later (re-running the build). |
| 132 | + gh release create "$TAG_NAME" \ |
| 133 | + --title "Release $TAG_NAME" \ |
| 134 | + --generate-notes \ |
| 135 | + --target "$GITHUB_REF_NAME" \ |
| 136 | + || echo "Release $TAG_NAME already exists, skipping creation." |
0 commit comments