Skip to content

Commit f87902b

Browse files
initial poc
1 parent e55aa2f commit f87902b

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "Build Docs on Release"
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
run-name: "Build and Publish Docs for release ${{ github.event.release.tag_name }}, Publish: ${{ github.event.release.draft == false }}"
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+
deploy: ${{ github.event.release.draft == false }}
16+
17+
steps:
18+
- name: Get latest released tag
19+
id: latest_tag
20+
uses: oprypin/find-latest-tag@v1
21+
with:
22+
repository: ${{ github.repository }}
23+
regex: ^v\d+\.\d+\.\d+$
24+
sort-tags: true
25+
releases-only: true
26+
27+
- name: Verify release tag
28+
id: tag_name
29+
run: |
30+
TAG_NAME=${{ github.event.release.tag_name }}
31+
if [[ ! "$TAG_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
32+
echo "Invalid tag format. Must be in the form vX.Y.Z"
33+
exit 1
34+
fi
35+
echo "tag=${TAG_NAME#v}" >> $GITHUB_OUTPUT
36+
37+
build-docs:
38+
needs: check-inputs
39+
name: "Build docs with version: ${{ needs.check-inputs.outputs.version }}, latest: ${{ needs.check-inputs.outputs.latest }}, deploy: ${{ needs.check-inputs.outputs.deploy }}"
40+
uses: ./.github/workflows/docs_build.yml
41+
with:
42+
version: ${{ needs.check-inputs.outputs.version }}
43+
latest: ${{ needs.check-inputs.outputs.latest }}
44+
deploy: ${{ needs.check-inputs.outputs.deploy }}

.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)