CI: Automatic pepy releases to PyPI (#131)

* workflows/release: Add PyPI release config

* util/release: Don't push to PyPI manually

The CI will handle this for us from now on.

* VERSION: 1.1.0.rc.1

* workflows/release: Try on this branch

* workflows/release: Syntax

* workflows/release: Disable on this branch

* VERSION: 1.1.0.rc.2
This commit is contained in:
William Woodruff 2020-04-20 14:57:01 -04:00 committed by GitHub
parent 8736072cc1
commit 4880b14a13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 8 deletions

34
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,34 @@
on:
push:
tags:
- 'v*'
name: release
jobs:
pypi:
name: upload release to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }}
- name: sdist
run: python3 setup.py sdist
- name: publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

View File

@ -1 +1 @@
1.0.2
1.1.0.rc.2

View File

@ -26,7 +26,7 @@ done
# Next, check the VERSION in version and make sure it doesn't already have a git tag.
[[ -f ./VERSION ]] || die "Missing VERSION file; wrong directory?"
version=$(<./VERSION)
version=v$(<./VERSION)
[[ -n $(git tag -l "${version}") ]] && die "git tag for ${version} already exists!"
# Next, craft a tag for the current HEAD. Push both the current commit and the tag.
@ -34,10 +34,4 @@ git tag "${version}"
git push
git push origin "${version}"
# Finally, build pepy and publish it to PyPI.
# Nuke the dist/ directory before, to avoid old sdists.
rm -rf dist/
python3 setup.py sdist
twine upload dist/*
echo OK