Skip to content

Commit b00fd37

Browse files
committed
chore(ci): split latest docs workflow
1 parent 075ac41 commit b00fd37

File tree

2 files changed

+64
-21
lines changed

2 files changed

+64
-21
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,12 @@ name: Publish to PyPi
3333
#
3434
# === Documentation hotfix ===
3535
#
36-
# 1. Trigger "Publish to PyPi" workflow manually: https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
37-
# 2. Use the latest version released under Releases e.g. v1.21.1
38-
# 3. Set `Build and publish docs only` field to `true`
36+
# Look for rebuild latest docs workflow
3937

4038

4139
on:
4240
release:
4341
types: [published]
44-
workflow_dispatch:
45-
inputs:
46-
publish_version:
47-
description: 'Version to publish, e.g. v1.13.0'
48-
required: true
49-
publish_docs_only:
50-
description: 'Build and publish docs only'
51-
required: false
52-
default: 'false'
5342

5443
jobs:
5544
release:
@@ -65,40 +54,33 @@ jobs:
6554
- name: Set release notes tag
6655
run: |
6756
RELEASE_TAG_VERSION=${{ github.event.release.tag_name }}
68-
# Replace publishing version if the workflow was triggered manually
69-
# test -n ${RELEASE_TAG_VERSION} && RELEASE_TAG_VERSION=${{ github.event.inputs.publish_version }}
7057
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
7158
- name: Ensure new version is also set in pyproject and CHANGELOG
72-
if: ${{ github.event.inputs.publish_docs_only == false }}
7359
run: |
7460
grep --regexp "${RELEASE_TAG_VERSION}" CHANGELOG.md
7561
grep --regexp "version \= \"${RELEASE_TAG_VERSION}\"" pyproject.toml
7662
- name: Install dependencies
7763
run: make dev
7864
- name: Run all tests, linting and baselines
79-
if: ${{ github.event.inputs.publish_docs_only == false }}
8065
run: make pr
8166
- name: Build python package and wheel
82-
if: ${{ github.event.inputs.publish_docs_only == false }}
8367
run: poetry build
8468
- name: Upload to PyPi test
85-
if: ${{ github.event.inputs.publish_docs_only == false }}
8669
run: make release-test
8770
env:
8871
PYPI_USERNAME: __token__
8972
PYPI_TEST_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }}
9073
- name: Upload to PyPi prod
91-
if: ${{ github.event.inputs.publish_docs_only == false }}
9274
run: make release-prod
9375
env:
9476
PYPI_USERNAME: __token__
9577
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
9678
- name: publish lambda layer in SAR by triggering the internal codepipeline
97-
if: ${{ github.event.inputs.publish_docs_only == false }}
9879
run: |
9980
aws ssm put-parameter --name "powertools-python-release-version" --value $RELEASE_TAG_VERSION --overwrite
10081
aws codepipeline start-pipeline-execution --name ${{ secrets.CODEPIPELINE_NAME }}
10182
env:
83+
# Maintenance: Migrate to new OAuth mechanism
10284
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
10385
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
10486
AWS_DEFAULT_REGION: eu-west-1
@@ -129,7 +111,6 @@ jobs:
129111
sync_master:
130112
needs: release
131113
runs-on: ubuntu-latest
132-
if: ${{ github.event.inputs.publish_docs_only == false }}
133114
steps:
134115
- uses: actions/checkout@v2
135116
- name: Sync master from detached head
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Rebuild latest docs
2+
3+
#
4+
# === Documentation hotfix ===
5+
#
6+
# 1. Trigger "Rebuild latest docs" workflow manually: https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
7+
# 2. Use the latest version released under Releases e.g. v1.22.0
8+
# 3. Set `Build and publish docs only` field to `true`
9+
10+
11+
on:
12+
workflow_dispatch:
13+
inputs:
14+
latest_published_version:
15+
description: 'Latest PyPi published version to rebuild latest docs for, e.g. v1.22.0'
16+
default: 'v1.22.0'
17+
required: true
18+
19+
20+
jobs:
21+
release:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
with:
26+
fetch-depth: 0
27+
- name: Set up Python
28+
uses: actions/setup-python@v2.2.2
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 aws-devax-open-source@amazon.com
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

0 commit comments

Comments
 (0)