Skip to content

Commit 37726c4

Browse files
committed
chore(ci): support manual trigger if gh action has failures
1 parent bc4da14 commit 37726c4

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

.github/scripts/post_release.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ const notifyRelease = async ({
100100

101101
// context: https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts
102102
module.exports = async ({ github, context }) => {
103-
const { RELEASE_TAG_VERSION } = process.env;
104-
console.log(`Running post-release script for ${RELEASE_TAG_VERSION} version`);
103+
const { RELEASE_VERSION } = process.env;
104+
console.log(`Running post-release script for ${RELEASE_VERSION} version`);
105105

106106
await notifyRelease({
107107
gh_client: github,
108108
owner: context.repo.owner,
109109
repository: context.repo.repo,
110-
release_version: RELEASE_TAG_VERSION,
110+
release_version: RELEASE_VERSION,
111111
});
112112
};

.github/workflows/publish.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@ name: Publish to PyPi
2222
on:
2323
release:
2424
types: [published]
25+
workflow_dispatch:
26+
inputs:
27+
version_to_publish:
28+
description: "Version to be released in PyPi, Docs, and Lambda Layer, e.g. v1.26.4"
29+
default: v1.26.4
30+
required: true
2531

2632
jobs:
2733
release:
2834
runs-on: ubuntu-latest
2935
outputs:
30-
RELEASE_TAG_VERSION: ${{ steps.release_version.outputs.RELEASE_TAG_VERSION }}
36+
RELEASE_VERSION: ${{ steps.release_version.outputs.RELEASE_VERSION }}
37+
env:
38+
RELEASE_TAG_VERSION: ${{ github.event.release.tag_name || inputs.version_to_publish }}
3139
steps:
3240
- uses: actions/checkout@v3
3341
with:
@@ -38,16 +46,17 @@ jobs:
3846
python-version: "3.8"
3947
- name: Set release notes tag
4048
id: release_version
49+
# transform tag format `v<version` to `<version`
4150
run: |
42-
RELEASE_TAG_VERSION=${{ github.event.release.tag_name }}
43-
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
44-
echo "::set-output name=RELEASE_TAG_VERSION::${RELEASE_TAG_VERSION}"
51+
RELEASE_VERSION=${RELEASE_TAG_VERSION:1}
52+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
53+
echo "::set-output name=RELEASE_VERSION::${RELEASE_VERSION}"
4554
- name: Install dependencies
4655
run: make dev
4756
- name: Run all tests, linting and baselines
4857
run: make pr
4958
- name: Bump package version
50-
run: poetry version ${RELEASE_TAG_VERSION}
59+
run: poetry version ${RELEASE_VERSION}
5160
- name: Generate latest CHANGELOG
5261
run: make changelog
5362
- name: Setup git client
@@ -58,7 +67,7 @@ jobs:
5867
run: |
5968
git add CHANGELOG.md
6069
git add pyproject.toml
61-
git commit -m "chore(ci): update project with version ${RELEASE_TAG_VERSION}"
70+
git commit -m "chore(ci): update project with version ${RELEASE_VERSION}"
6271
git push origin HEAD:refs/heads/develop
6372
- name: Build python package and wheel
6473
run: poetry build
@@ -74,7 +83,7 @@ jobs:
7483
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
7584
- name: publish lambda layer in SAR by triggering the internal codepipeline
7685
run: |
77-
aws ssm put-parameter --name "powertools-python-release-version" --value $RELEASE_TAG_VERSION --overwrite
86+
aws ssm put-parameter --name "powertools-python-release-version" --value $RELEASE_VERSION --overwrite
7887
aws codepipeline start-pipeline-execution --name ${{ secrets.CODEPIPELINE_NAME }}
7988
env:
8089
# Maintenance: Migrate to new OAuth mechanism
@@ -87,22 +96,22 @@ jobs:
8796
needs: release
8897
runs-on: ubuntu-latest
8998
env:
90-
RELEASE_TAG_VERSION: ${{ needs.release.outputs.RELEASE_TAG_VERSION }}
99+
RELEASE_VERSION: ${{ needs.release.outputs.RELEASE_VERSION }}
91100
steps:
92101
- uses: actions/checkout@v3
93102
with:
94103
fetch-depth: 0
95104
- name: Build docs website and API reference
96105
run: |
97-
make release-docs VERSION=${RELEASE_TAG_VERSION} ALIAS="latest"
106+
make release-docs VERSION=${RELEASE_VERSION} ALIAS="latest"
98107
poetry run mike set-default --push latest
99108
- name: Release API docs to release version
100109
uses: peaceiris/actions-gh-pages@v3
101110
with:
102111
github_token: ${{ secrets.GITHUB_TOKEN }}
103112
publish_dir: ./api
104113
keep_files: true
105-
destination_dir: ${{ env.RELEASE_TAG_VERSION }}/api
114+
destination_dir: ${{ env.RELEASE_VERSION }}/api
106115
- name: Release API docs to latest
107116
uses: peaceiris/actions-gh-pages@v3
108117
with:
@@ -115,7 +124,7 @@ jobs:
115124
needs: release
116125
runs-on: ubuntu-latest
117126
env:
118-
RELEASE_TAG_VERSION: ${{ needs.release.outputs.RELEASE_TAG_VERSION }}
127+
RELEASE_VERSION: ${{ needs.release.outputs.RELEASE_VERSION }}
119128
steps:
120129
- uses: actions/checkout@v3
121130
- name: Close issues related to this release

0 commit comments

Comments
 (0)