File tree Expand file tree Collapse file tree 3 files changed +54
-3
lines changed
Expand file tree Collapse file tree 3 files changed +54
-3
lines changed Original file line number Diff line number Diff line change 11name : Publish Python package
22
33on :
4- push :
5- tags :
4+ push :
5+ branches :
6+ - main
7+ - master
68
79jobs :
810 publish :
1214 steps :
1315 - uses : actions/checkout@v2
1416
17+ - name : get release info
18+ id : release_info
19+ run : |
20+ version="$(awk '/^## / { print tolower($2) }' CHANGELOG.md | head -1)"
21+ echo "::set-output name=version::$version"
22+
1523 - name : Set up Python 3.7
1624 uses : actions/setup-python@v2
1725 with :
4149 python setup.py sdist bdist_wheel
4250
4351 - name : Publish distribution to PyPI
44- if : startsWith(github.ref, 'refs/tags')
52+ if : steps.release_info.outputs.version != 'unreleased'
4553 uses : pypa/gh-action-pypi-publish@master
4654 with :
4755 password : ${{ secrets.pypi_password }}
Original file line number Diff line number Diff line change 1+ name : Create Release
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - master
8+
9+ jobs :
10+ release :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout
14+ uses : actions/checkout@v2
15+ with :
16+ fetch-depth : 0
17+
18+ - name : get release info
19+ id : release_info
20+ run : |
21+ version="$(awk '/^## / { print tolower($2) }' CHANGELOG.md | head -1)"
22+ changelog="$(sed -e "1,/^## ${version}/d" -e "/^## /,\$d" CHANGELOG.md)"
23+ changelog="${changelog//'%'/'%25'}"
24+ changelog="${changelog//$'\n'/'%0A'}"
25+ changelog="${changelog//$'\r'/'%0D'}"
26+ echo "::set-output name=version::$version"
27+ echo "::set-output name=changelog::$changelog"
28+
29+ - name : create release
30+ if : steps.release_info.outputs.version != 'unreleased'
31+ uses : actions/create-release@v1
32+ id : create_release
33+ env :
34+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35+ with :
36+ tag_name : ${{ steps.release_info.outputs.version }}
37+ release_name : Release ${{ steps.release_info.outputs.version }}
38+ body : ${{ steps.release_info.outputs.changelog }}
Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
55and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
66
7+ ## unreleased
8+
9+ ### Changed
10+ - updated github actions to automatically create releases
11+
712## 2.4.0 - 2021-02-22
813
914### Changed
You can’t perform that action at this time.
0 commit comments