@@ -22,7 +22,7 @@ name: Publish to PyPi
2222# 8. Builds a fresh version of docs including Changelog updates
2323# 9. Push latest release source code to master using release title as the commit message
2424# 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+ # 11. Close and notify all issues labeled "pending -release" about the release details
2626
2727#
2828# === Fallback mechanism due to external failures ===
@@ -36,7 +36,6 @@ name: Publish to PyPi
3636#
3737# Look for rebuild latest docs workflow
3838
39-
4039on :
4140 release :
4241 types : [published]
@@ -45,84 +44,84 @@ jobs:
4544 release :
4645 runs-on : ubuntu-latest
4746 steps :
48- - uses : actions/checkout@v3
49- with :
50- fetch-depth : 0
51- - name : Set up Python
52- uses : actions/setup-python@v3
53- with :
54- python-version : " 3.8"
55- - name : Set release notes tag
56- run : |
57- RELEASE_TAG_VERSION=${{ github.event.release.tag_name }}
58- echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
59- - name : Ensure new version is also set in pyproject and CHANGELOG
60- run : |
61- grep --regexp "${RELEASE_TAG_VERSION}" CHANGELOG.md
62- grep --regexp "version \= \"${RELEASE_TAG_VERSION}\"" pyproject.toml
63- - name : Install dependencies
64- run : make dev
65- - name : Run all tests, linting and baselines
66- run : make pr
67- - name : Build python package and wheel
68- run : poetry build
69- - name : Upload to PyPi test
70- run : make release-test
71- env :
72- PYPI_USERNAME : __token__
73- PYPI_TEST_TOKEN : ${{ secrets.PYPI_TEST_TOKEN }}
74- - name : Upload to PyPi prod
75- run : make release-prod
76- env :
77- PYPI_USERNAME : __token__
78- PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
79- - name : publish lambda layer in SAR by triggering the internal codepipeline
80- run : |
81- aws ssm put-parameter --name "powertools-python-release-version" --value $RELEASE_TAG_VERSION --overwrite
82- aws codepipeline start-pipeline-execution --name ${{ secrets.CODEPIPELINE_NAME }}
83- env :
84- # Maintenance: Migrate to new OAuth mechanism
85- AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
86- AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
87- AWS_DEFAULT_REGION : eu-west-1
88- AWS_DEFAULT_OUTPUT : json
89- - name : Setup doc deploy
90- run : |
91- git config --global user.name Docs deploy
92- git config --global user.email aws-devax-open-source@amazon.com
93- - name : Build docs website and API reference
94- run : |
95- make release-docs VERSION=${RELEASE_TAG_VERSION} ALIAS="latest"
96- poetry run mike set-default --push latest
97- - name : Release API docs to release version
98- uses : peaceiris/actions-gh-pages@v3
99- with :
100- github_token : ${{ secrets.GITHUB_TOKEN }}
101- publish_dir : ./api
102- keep_files : true
103- destination_dir : ${{ env.RELEASE_TAG_VERSION }}/api
104- - name : Release API docs to latest
105- uses : peaceiris/actions-gh-pages@v3
106- with :
107- github_token : ${{ secrets.GITHUB_TOKEN }}
108- publish_dir : ./api
109- keep_files : true
110- destination_dir : latest/api
111- - name : Close issues related to this release
112- uses : actions/github-script@v6
113- with :
114- script : |
115- const post_release = require('.github/workflows/post_release.js')
116- await post_release({github, context, core})
47+ - uses : actions/checkout@v3
48+ with :
49+ fetch-depth : 0
50+ - name : Set up Python
51+ uses : actions/setup-python@v3
52+ with :
53+ python-version : " 3.8"
54+ - name : Set release notes tag
55+ run : |
56+ RELEASE_TAG_VERSION=${{ github.event.release.tag_name }}
57+ echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
58+ - name : Ensure new version is also set in pyproject and CHANGELOG
59+ run : |
60+ grep --regexp "${RELEASE_TAG_VERSION}" CHANGELOG.md
61+ grep --regexp "version \= \"${RELEASE_TAG_VERSION}\"" pyproject.toml
62+ - name : Install dependencies
63+ run : make dev
64+ - name : Run all tests, linting and baselines
65+ run : make pr
66+ - name : Build python package and wheel
67+ run : poetry build
68+ - name : Upload to PyPi test
69+ run : make release-test
70+ env :
71+ PYPI_USERNAME : __token__
72+ PYPI_TEST_TOKEN : ${{ secrets.PYPI_TEST_TOKEN }}
73+ - name : Upload to PyPi prod
74+ run : make release-prod
75+ env :
76+ PYPI_USERNAME : __token__
77+ PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
78+ - name : publish lambda layer in SAR by triggering the internal codepipeline
79+ run : |
80+ aws ssm put-parameter --name "powertools-python-release-version" --value $RELEASE_TAG_VERSION --overwrite
81+ aws codepipeline start-pipeline-execution --name ${{ secrets.CODEPIPELINE_NAME }}
82+ env :
83+ # Maintenance: Migrate to new OAuth mechanism
84+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
85+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
86+ AWS_DEFAULT_REGION : eu-west-1
87+ AWS_DEFAULT_OUTPUT : json
88+ - name : Setup doc deploy
89+ run : |
90+ git config --global user.name Docs deploy
91+ git config --global user.email aws-devax-open-source@amazon.com
92+ - name : Build docs website and API reference
93+ run : |
94+ make release-docs VERSION=${RELEASE_TAG_VERSION} ALIAS="latest"
95+ poetry run mike set-default --push latest
96+ - name : Release API docs to release version
97+ uses : peaceiris/actions-gh-pages@v3
98+ with :
99+ github_token : ${{ secrets.GITHUB_TOKEN }}
100+ publish_dir : ./api
101+ keep_files : true
102+ destination_dir : ${{ env.RELEASE_TAG_VERSION }}/api
103+ - name : Release API docs to latest
104+ uses : peaceiris/actions-gh-pages@v3
105+ with :
106+ github_token : ${{ secrets.GITHUB_TOKEN }}
107+ publish_dir : ./api
108+ keep_files : true
109+ destination_dir : latest/api
110+ - name : Close issues related to this release
111+ uses : actions/github-script@v6
112+ with :
113+ script : |
114+ const post_release = require('.github/workflows/post_release.js')
115+ await post_release({github, context, core})
117116
118117 sync_master :
119118 needs : release
120119 runs-on : ubuntu-latest
121120 steps :
122- - uses : actions/checkout@v3
123- - name : Sync master from detached head
124- # If version matches CHANGELOG and pyproject.toml
125- # If it passes all checks, successfully releases to test and prod
126- # Then sync up master with latest source code release
127- # where commit message will be Release notes title
128- run : git push origin HEAD:refs/heads/master --force
121+ - uses : actions/checkout@v3
122+ - name : Sync master from detached head
123+ # If version matches CHANGELOG and pyproject.toml
124+ # If it passes all checks, successfully releases to test and prod
125+ # Then sync up master with latest source code release
126+ # where commit message will be Release notes title
127+ run : git push origin HEAD:refs/heads/master --force
0 commit comments