Skip to content

Commit b2fa2fb

Browse files
committed
chore(ci): limits concurrency for docs workflow
1 parent 58d3be7 commit b2fa2fb

File tree

2 files changed

+49
-43
lines changed

2 files changed

+49
-43
lines changed

.github/workflows/python_docs.yml

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212

1313
jobs:
1414
docs:
15+
# Force Github action to run only a single job at a time (based on the group name)
16+
# This is to prevent "race-condition" in publishing a new version of doc to `gh-pages`
17+
concurrency:
18+
group: on-docs-build
1519
runs-on: ubuntu-latest
1620
steps:
1721
- uses: actions/checkout@v3

.github/workflows/rebuild_latest_docs.yml

+45-43
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,58 @@ name: Rebuild latest docs
77
# 2. Use the latest version released under Releases e.g. v1.22.0
88
# 3. Set `Build and publish docs only` field to `true`
99

10-
1110
on:
1211
workflow_dispatch:
1312
inputs:
1413
latest_published_version:
15-
description: 'Latest PyPi published version to rebuild latest docs for, e.g. v1.22.0'
16-
default: 'v1.22.0'
14+
description: "Latest PyPi published version to rebuild latest docs for, e.g. v1.22.0"
15+
default: "v1.22.0"
1716
required: true
1817

19-
2018
jobs:
2119
release:
20+
# Force Github action to run only a single job at a time (based on the group name)
21+
# This is to prevent "race-condition" in publishing a new version of doc to `gh-pages`
22+
concurrency:
23+
group: on-docs-rebuild
2224
runs-on: ubuntu-latest
2325
steps:
24-
- uses: actions/checkout@v3
25-
with:
26-
fetch-depth: 0
27-
- name: Set up Python
28-
uses: actions/setup-python@v4
29-
with:
30-
python-version: "3.8"
31-
- name: Set release notes tag
32-
run: |
33-
RELEASE_TAG_VERSION=${{ github.event.inputs.latest_published_version }}
34-
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
35-
- name: Ensure new version is also set in pyproject and CHANGELOG
36-
run: |
37-
grep --regexp "${RELEASE_TAG_VERSION}" CHANGELOG.md
38-
grep --regexp "version \= \"${RELEASE_TAG_VERSION}\"" pyproject.toml
39-
- name: Install dependencies
40-
run: make dev
41-
- name: Setup doc deploy
42-
run: |
43-
git config --global user.name Docs deploy
44-
git config --global user.email [email protected]
45-
- name: Build docs website and API reference
46-
run: |
47-
make release-docs VERSION=${RELEASE_TAG_VERSION} ALIAS="latest"
48-
poetry run mike set-default --push latest
49-
- name: Release API docs to release version
50-
uses: peaceiris/actions-gh-pages@v3
51-
with:
52-
github_token: ${{ secrets.GITHUB_TOKEN }}
53-
publish_dir: ./api
54-
keep_files: true
55-
destination_dir: ${{ env.RELEASE_TAG_VERSION }}/api
56-
- name: Release API docs to latest
57-
uses: peaceiris/actions-gh-pages@v3
58-
with:
59-
github_token: ${{ secrets.GITHUB_TOKEN }}
60-
publish_dir: ./api
61-
keep_files: true
62-
destination_dir: latest/api
26+
- uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 0
29+
- name: Set up Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: "3.8"
33+
- name: Set release notes tag
34+
run: |
35+
RELEASE_TAG_VERSION=${{ github.event.inputs.latest_published_version }}
36+
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
37+
- name: Ensure new version is also set in pyproject and CHANGELOG
38+
run: |
39+
grep --regexp "${RELEASE_TAG_VERSION}" CHANGELOG.md
40+
grep --regexp "version \= \"${RELEASE_TAG_VERSION}\"" pyproject.toml
41+
- name: Install dependencies
42+
run: make dev
43+
- name: Setup doc deploy
44+
run: |
45+
git config --global user.name Docs deploy
46+
git config --global user.email [email protected]
47+
- name: Build docs website and API reference
48+
run: |
49+
make release-docs VERSION=${RELEASE_TAG_VERSION} ALIAS="latest"
50+
poetry run mike set-default --push latest
51+
- name: Release API docs to release version
52+
uses: peaceiris/actions-gh-pages@v3
53+
with:
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
publish_dir: ./api
56+
keep_files: true
57+
destination_dir: ${{ env.RELEASE_TAG_VERSION }}/api
58+
- name: Release API docs to latest
59+
uses: peaceiris/actions-gh-pages@v3
60+
with:
61+
github_token: ${{ secrets.GITHUB_TOKEN }}
62+
publish_dir: ./api
63+
keep_files: true
64+
destination_dir: latest/api

0 commit comments

Comments
 (0)