Skip to content

Commit 366eb9a

Browse files
Implementation
1 parent e55aa2f commit 366eb9a

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Build Docs on Release"
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
run-name: "Build and Publish Docs for release ${{ github.event.release.tag_name }}"
8+
jobs:
9+
check-inputs:
10+
name: Check inputs
11+
runs-on: ubuntu-latest
12+
outputs:
13+
version: ${{ steps.tag_name.outputs.tag }}
14+
latest: ${{ github.event.release.tag_name == steps.latest_tag.outputs.tag }}
15+
16+
steps:
17+
- name: Get latest released tag
18+
id: latest_tag
19+
uses: oprypin/find-latest-tag@v1
20+
with:
21+
repository: ${{ github.repository }}
22+
regex: ^v\d+\.\d+\.\d+$
23+
sort-tags: true
24+
releases-only: true
25+
26+
- name: Verify release tag
27+
id: tag_name
28+
run: |
29+
TAG_NAME=${{ github.event.release.tag_name }}
30+
if [[ ! $TAG_NAME =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
31+
echo "Error: Release tag name is not in the correct format. Expected: vX.Y.Z, Actual: $TAG_NAME"
32+
exit 1
33+
fi
34+
echo "tag=${TAG_NAME#v}" >> $GITHUB_OUTPUT
35+
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
with:
39+
ref: v${{ steps.tag_name.outputs.tag }}
40+
41+
- name: Create docs tag
42+
id: create_docs_tag
43+
run: |
44+
DOCS_TAG_NAME=v${{ steps.tag_name.outputs.tag }}-docs
45+
git tag $DOCS_TAG_NAME
46+
git push origin $DOCS_TAG_NAME
47+
continue-on-error: true
48+
49+
build-docs:
50+
needs: check-inputs
51+
name: "Build docs with version: ${{ needs.check-inputs.outputs.version }}, latest: ${{ needs.check-inputs.outputs.latest }}"
52+
uses: ./.github/workflows/docs_build.yml
53+
with:
54+
version: ${{ needs.check-inputs.outputs.version }}
55+
latest: ${{ needs.check-inputs.outputs.latest }}
56+
deploy: true

.github/workflows/docs_build.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ on:
55
version: { type: string, required: false, description: "The version to build (used in git and pypi). git-tag='v{version}-docs'. If not specified then use selected branch and wheel from the last successful build."}
66
latest: { type: boolean, required: false, description: Alias this version as the 'latest' stable docs. This should be set for the latest stable release.}
77
deploy: { type: boolean, required: false, description: Push the built docs to the docs-pages branch on github.}
8-
8+
workflow_call:
9+
inputs:
10+
version: { type: string, required: true, description: "The version to build (used in git and pypi). git-tag='v{version}-docs'."}
11+
latest: { type: boolean, required: true, description: Alias this version as the 'latest' stable docs. This should be set for the latest stable release.}
12+
deploy: { type: boolean, required: true, description: Push the built docs to the docs-pages branch on github.}
913
jobs:
1014
docs_build:
1115
runs-on: ubuntu-22.04

0 commit comments

Comments
 (0)