Skip to content

Commit fbd6406

Browse files
committed
💨 Add version retrieval step for manual and tag-based deployments
1 parent 0cc95ce commit fbd6406

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/deploy-mkdocs.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
steps:
1515
- name: Checkout repo
1616
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
1719

1820
- name: Set up Python
1921
uses: actions/setup-python@v4
@@ -37,6 +39,19 @@ jobs:
3739
- name: Install dependencies
3840
run: poetry install --all-extras
3941

42+
- name: Get version for deployment
43+
id: get_version
44+
run: |
45+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
46+
# For manual runs, get the latest tag
47+
VERSION=$(git describe --tags --abbrev=0)
48+
echo "version=$VERSION" >> $GITHUB_OUTPUT
49+
else
50+
# For tag pushes, use the tag name
51+
VERSION="${{ github.ref_name }}"
52+
echo "version=$VERSION" >> $GITHUB_OUTPUT
53+
fi
54+
4055
- name: fetch from gh-pages
4156
run: git fetch origin gh-pages --depth=1
4257

@@ -47,4 +62,4 @@ jobs:
4762
4863
- name: Deploy with mike
4964
run: |
50-
poetry run mike deploy -b gh-pages --update-aliases --push "${{ github.ref_name }}" "latest"
65+
poetry run mike deploy -b gh-pages --update-aliases --push "${{ steps.get_version.outputs.version }}" "latest"

0 commit comments

Comments
 (0)