Skip to content

Commit 806a5b7

Browse files
authored
chore: update mike to use a branch instead of release (Universal-Commerce-Protocol#111)
* Update mike to use a branch instead of release
1 parent f608be2 commit 806a5b7

1 file changed

Lines changed: 27 additions & 12 deletions

File tree

.github/workflows/docs.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@
1515
name: Docs Build and Deploy
1616

1717
on:
18+
workflow_dispatch:
19+
1820
push:
1921
branches:
2022
- main
21-
paths:
22-
- ".github/workflows/docs.yml"
23-
- "requirements-docs.txt"
24-
- "mkdocs.yml"
25-
- "main.py"
26-
- "docs/**"
27-
- "spec/**"
23+
- 'release/**'
2824
pull_request:
2925
branches:
3026
- main
@@ -112,10 +108,29 @@ jobs:
112108
run: |
113109
mike deploy --push draft
114110
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/')
117113
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
121119
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

Comments
 (0)