Skip to content

Commit 2c0e031

Browse files
Implementation
1 parent e55aa2f commit 2c0e031

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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: Get version from release tag
27+
id: tag_name
28+
run: |
29+
TAG_NAME=${{ github.event.release.tag_name }}
30+
echo "tag=${TAG_NAME#v}" >> $GITHUB_OUTPUT
31+
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
with:
35+
ref: v${{ steps.tag_name.outputs.tag }}
36+
37+
- name: Create docs tag
38+
id: create_docs_tag
39+
run: |
40+
DOCS_TAG_NAME=v${{ steps.tag_name.outputs.tag }}-docs
41+
git tag $DOCS_TAG_NAME
42+
git push origin $DOCS_TAG_NAME
43+
continue-on-error: true
44+
45+
build-docs:
46+
needs: check-inputs
47+
name: "Build docs with version: ${{ needs.check-inputs.outputs.version }}, latest: ${{ needs.check-inputs.outputs.latest }}"
48+
uses: ./.github/workflows/docs_build.yml
49+
with:
50+
version: ${{ needs.check-inputs.outputs.version }}
51+
latest: ${{ needs.check-inputs.outputs.latest }}
52+
deploy: false

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