@@ -22,12 +22,20 @@ name: Publish to PyPi
22
22
on :
23
23
release :
24
24
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
25
31
26
32
jobs :
27
33
release :
28
34
runs-on : ubuntu-latest
29
35
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 }}
31
39
steps :
32
40
- uses : actions/checkout@v3
33
41
with :
@@ -38,16 +46,17 @@ jobs:
38
46
python-version : " 3.8"
39
47
- name : Set release notes tag
40
48
id : release_version
49
+ # transform tag format `v<version` to `<version`
41
50
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 }"
45
54
- name : Install dependencies
46
55
run : make dev
47
56
- name : Run all tests, linting and baselines
48
57
run : make pr
49
58
- name : Bump package version
50
- run : poetry version ${RELEASE_TAG_VERSION }
59
+ run : poetry version ${RELEASE_VERSION }
51
60
- name : Generate latest CHANGELOG
52
61
run : make changelog
53
62
- name : Setup git client
58
67
run : |
59
68
git add CHANGELOG.md
60
69
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 }"
62
71
git push origin HEAD:refs/heads/develop
63
72
- name : Build python package and wheel
64
73
run : poetry build
74
83
PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
75
84
- name : publish lambda layer in SAR by triggering the internal codepipeline
76
85
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
78
87
aws codepipeline start-pipeline-execution --name ${{ secrets.CODEPIPELINE_NAME }}
79
88
env :
80
89
# Maintenance: Migrate to new OAuth mechanism
@@ -87,22 +96,22 @@ jobs:
87
96
needs : release
88
97
runs-on : ubuntu-latest
89
98
env :
90
- RELEASE_TAG_VERSION : ${{ needs.release.outputs.RELEASE_TAG_VERSION }}
99
+ RELEASE_VERSION : ${{ needs.release.outputs.RELEASE_VERSION }}
91
100
steps :
92
101
- uses : actions/checkout@v3
93
102
with :
94
103
fetch-depth : 0
95
104
- name : Build docs website and API reference
96
105
run : |
97
- make release-docs VERSION=${RELEASE_TAG_VERSION } ALIAS="latest"
106
+ make release-docs VERSION=${RELEASE_VERSION } ALIAS="latest"
98
107
poetry run mike set-default --push latest
99
108
- name : Release API docs to release version
100
109
uses : peaceiris/actions-gh-pages@v3
101
110
with :
102
111
github_token : ${{ secrets.GITHUB_TOKEN }}
103
112
publish_dir : ./api
104
113
keep_files : true
105
- destination_dir : ${{ env.RELEASE_TAG_VERSION }}/api
114
+ destination_dir : ${{ env.RELEASE_VERSION }}/api
106
115
- name : Release API docs to latest
107
116
uses : peaceiris/actions-gh-pages@v3
108
117
with :
@@ -115,7 +124,7 @@ jobs:
115
124
needs : release
116
125
runs-on : ubuntu-latest
117
126
env :
118
- RELEASE_TAG_VERSION : ${{ needs.release.outputs.RELEASE_TAG_VERSION }}
127
+ RELEASE_VERSION : ${{ needs.release.outputs.RELEASE_VERSION }}
119
128
steps :
120
129
- uses : actions/checkout@v3
121
130
- name : Close issues related to this release
0 commit comments