@@ -22,6 +22,7 @@ name: Publish to PyPi
22
22
# 8. Builds a fresh version of docs including Changelog updates
23
23
# 9. Push latest release source code to master using release title as the commit message
24
24
# 10. Builds latest documentation for new release, and update latest alias pointing to the new release tag
25
+ # 11. Close and notify all issues labeled "status/staged-next-release" about the release details
25
26
26
27
#
27
28
# === Fallback mechanism due to external failures ===
@@ -33,23 +34,12 @@ name: Publish to PyPi
33
34
#
34
35
# === Documentation hotfix ===
35
36
#
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`
37
+ # Look for rebuild latest docs workflow
39
38
40
39
41
40
on :
42
41
release :
43
42
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'
53
43
54
44
jobs :
55
45
release :
@@ -59,46 +49,39 @@ jobs:
59
49
with :
60
50
fetch-depth : 0
61
51
- name : Set up Python
62
- uses : actions/setup-python@v2.2.2
52
+ uses : actions/setup-python@v2.3.1
63
53
with :
64
54
python-version : " 3.8"
65
55
- name : Set release notes tag
66
56
run : |
67
57
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 }}
70
58
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
71
59
- name : Ensure new version is also set in pyproject and CHANGELOG
72
- if : ${{ github.event.inputs.publish_docs_only == false }}
73
60
run : |
74
61
grep --regexp "${RELEASE_TAG_VERSION}" CHANGELOG.md
75
62
grep --regexp "version \= \"${RELEASE_TAG_VERSION}\"" pyproject.toml
76
63
- name : Install dependencies
77
64
run : make dev
78
65
- name : Run all tests, linting and baselines
79
- if : ${{ github.event.inputs.publish_docs_only == false }}
80
66
run : make pr
81
67
- name : Build python package and wheel
82
- if : ${{ github.event.inputs.publish_docs_only == false }}
83
68
run : poetry build
84
69
- name : Upload to PyPi test
85
- if : ${{ github.event.inputs.publish_docs_only == false }}
86
70
run : make release-test
87
71
env :
88
72
PYPI_USERNAME : __token__
89
73
PYPI_TEST_TOKEN : ${{ secrets.PYPI_TEST_TOKEN }}
90
74
- name : Upload to PyPi prod
91
- if : ${{ github.event.inputs.publish_docs_only == false }}
92
75
run : make release-prod
93
76
env :
94
77
PYPI_USERNAME : __token__
95
78
PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
96
79
- name : publish lambda layer in SAR by triggering the internal codepipeline
97
- if : ${{ github.event.inputs.publish_docs_only == false }}
98
80
run : |
99
81
aws ssm put-parameter --name "powertools-python-release-version" --value $RELEASE_TAG_VERSION --overwrite
100
82
aws codepipeline start-pipeline-execution --name ${{ secrets.CODEPIPELINE_NAME }}
101
83
env :
84
+ # Maintenance: Migrate to new OAuth mechanism
102
85
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
103
86
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
104
87
AWS_DEFAULT_REGION : eu-west-1
@@ -125,11 +108,16 @@ jobs:
125
108
publish_dir : ./api
126
109
keep_files : true
127
110
destination_dir : latest/api
111
+ - name : Close issues related to this release
112
+ uses : actions/github-script@v5
113
+ with :
114
+ script : |
115
+ const post_release = require('.github/workflows/post_release.js')
116
+ await post_release({github, context, core})
128
117
129
118
sync_master :
130
119
needs : release
131
120
runs-on : ubuntu-latest
132
- if : ${{ github.event.inputs.publish_docs_only == false }}
133
121
steps :
134
122
- uses : actions/checkout@v2
135
123
- name : Sync master from detached head
0 commit comments