Skip to content

Commit 4880b14

Browse files
authored
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
1 parent 8736072 commit 4880b14

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: release
7+
8+
jobs:
9+
pypi:
10+
name: upload release to PyPI
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.8
17+
- name: create release
18+
id: create_release
19+
uses: actions/create-release@v1
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
with:
23+
tag_name: ${{ github.ref }}
24+
release_name: Release ${{ github.ref }}
25+
draft: false
26+
prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }}
27+
- name: sdist
28+
run: python3 setup.py sdist
29+
- name: publish
30+
uses: pypa/gh-action-pypi-publish@master
31+
with:
32+
user: __token__
33+
password: ${{ secrets.PYPI_TOKEN }}
34+

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.2
1+
1.1.0.rc.2

util/release

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,12 @@ done
2626

2727
# Next, check the VERSION in version and make sure it doesn't already have a git tag.
2828
[[ -f ./VERSION ]] || die "Missing VERSION file; wrong directory?"
29-
version=$(<./VERSION)
29+
version=v$(<./VERSION)
3030
[[ -n $(git tag -l "${version}") ]] && die "git tag for ${version} already exists!"
3131

3232
# Next, craft a tag for the current HEAD. Push both the current commit and the tag.
3333
git tag "${version}"
3434
git push
3535
git push origin "${version}"
3636

37-
# Finally, build pepy and publish it to PyPI.
38-
# Nuke the dist/ directory before, to avoid old sdists.
39-
rm -rf dist/
40-
python3 setup.py sdist
41-
twine upload dist/*
42-
4337
echo OK

0 commit comments

Comments
 (0)