-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Release on GitHub & PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: python -m pip install -U poetry | ||
- run: poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} --build | ||
- run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- run: gh release create -t "Release ${{ env.TAG}}" -n "$(awk '/## \[${{ env.TAG }}] - /{flag=1;next}/## \[/{flag=0}flag' CHANGELOG.md)" ${{ env.TAG }} dist/* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Publish a new release | ||
|
||
A github actions handle the build of the release archives, and push them to PyPI and Github Releases. | ||
To trigger it, we just need to: | ||
|
||
1. use poetry to update the version number | ||
2. update `__version__` in `cmw.py` | ||
3. update the changelog | ||
3. `git commit` | ||
4. `git tag` | ||
5. `git push` | ||
6. `git push --tags` | ||
|
||
|
||
For this, an helper script is provided: | ||
|
||
```bash | ||
./docs/release.sh [patch|minor|major|x.y.z] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash -eux | ||
# ./docs/release.sh [patch|minor|major|x.y.z] | ||
|
||
[[ $(basename "$PWD") == docs ]] && cd .. | ||
|
||
|
||
OLD=$(poetry version -s) | ||
|
||
poetry version "$1" | ||
|
||
NEW=$(poetry version -s) | ||
DATE=$(date +%Y-%m-%d) | ||
|
||
sed -ri "/__version__ /s/[0-9.]+/$NEW/" cmw.py | ||
sed -i "/^## \[Unreleased\]/a \\\n## [v$NEW] - $DATE" CHANGELOG.md | ||
sed -i "/^\[Unreleased\]/s/$OLD/$NEW/" CHANGELOG.md | ||
sed -i "/^\[Unreleased\]/a [v$NEW]: https://github.com/nim65s/cmw/compare/v$OLD...v$NEW" CHANGELOG.md | ||
|
||
git add cmw.py pyproject.toml CHANGELOG.md | ||
git commit -m "Release v$NEW" | ||
git tag -s "v$NEW" -m "Release v$NEW" | ||
git push | ||
git push --tags |