-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move version into __init__.py * add manually dispatched release action * add changelog + bump version * also create a tag on the released commit
- Loading branch information
1 parent
b7f70e4
commit 5e1a673
Showing
4 changed files
with
98 additions
and
1 deletion.
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,81 @@ | ||
name: Release To PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
requested_release_tag: | ||
description: 'The tag to use for this release (e.g., `v2.3.0`)' | ||
required: true | ||
|
||
jobs: | ||
build_and_upload: | ||
runs-on: arc-amd64-runners | ||
environment: production | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: 3.8 | ||
|
||
- run: | | ||
pip install packaging | ||
- name: Normalize the release version | ||
run: | | ||
echo "release_version=`echo '${{ github.event.inputs.requested_release_tag }}' | sed 's/^v//'`" >> $GITHUB_ENV | ||
- name: Normalize the release tag | ||
run: | | ||
echo "release_tag=v${release_version}" >> $GITHUB_ENV | ||
- name: Get the VERSION from setup.py | ||
run: | | ||
echo "package_version=`grep -Po '__version__ = "\K[^"]*' quotequail/__init__.py`" >> $GITHUB_ENV | ||
- name: Get the latest version from PyPI | ||
run: | | ||
curl https://pypi.org/pypi/quotequail/json | python -c 'import json, sys; contents=sys.stdin.read(); parsed = json.loads(contents); print("pypi_version=" + parsed["info"]["version"])' >> $GITHUB_ENV | ||
- name: Log all the things | ||
run: | | ||
echo 'Requested release tag `${{ github.event.inputs.requested_release_tag }}`' | ||
echo 'Release version `${{ env.release_version }}`' | ||
echo 'Release tag `${{ env.release_tag }}`' | ||
echo 'version in package `${{ env.package_version }}`' | ||
echo 'Version in PyPI `${{ env.pypi_version }}`' | ||
- name: Verify that the version string we produced looks like a version string | ||
run: | | ||
echo "${{ env.release_version }}" | sed '/^[0-9]\+\.[0-9]\+\.[0-9]\+$/!{q1}' | ||
- name: Verify that the version tag we produced looks like a version tag | ||
run: | | ||
echo "${{ env.release_tag }}" | sed '/^v[0-9]\+\.[0-9]\+\.[0-9]\+$/!{q1}' | ||
- name: Verify that the release version matches the VERSION in the package source | ||
run: | | ||
[[ ${{ env.release_version }} == ${{ env.package_version }} ]] | ||
- name: Verify that the `release_version` is larger/newer than the existing release in PyPI | ||
run: | | ||
python -c 'import sys; from packaging import version; code = 0 if version.parse("${{ env.package_version }}") > version.parse("${{ env.pypi_version }}") else 1; sys.exit(code)' | ||
- name: Verify that the `release_version` is present in the CHANGELOG | ||
run: | | ||
grep ${{ env.release_version }} CHANGELOG.md | ||
- name: Serialize normalized release values as outputs | ||
run: | | ||
echo "release_version=$release_version" | ||
echo "release_tag=$release_tag" | ||
echo "release_version=$release_version" >> $GITHUB_OUTPUT | ||
echo "release_tag=$release_tag" >> $GITHUB_OUTPUT | ||
- name: Tag commit | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/${{ env.release_tag }}', | ||
sha: context.sha | ||
}) | ||
- name: Build Source Distribution | ||
run: | | ||
python setup.py sdist | ||
- name: Upload to PyPI | ||
uses: closeio/gh-action-pypi-publish@a260c7e54e4251db69485e1e7ca271aec8c0ddf9 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_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,9 @@ | ||
# Changes | ||
|
||
## v0.2.4 | ||
|
||
* First version using auto-release process | ||
* Added support for russian, portuguese, and swedish reply patterns | ||
* Fixed bug where newlines just before "wrote:" weren't detected | ||
* updated repo to apply more modern linting + code style | ||
|
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
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