Skip to content

Commit 114b07e

Browse files
authored
Merge pull request #157 from maxmind/greg/automate-releases
Release from GitHub Actions
2 parents 8de03f7 + fb283e1 commit 114b07e

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and upload to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
12+
13+
jobs:
14+
build:
15+
name: Build source distribution
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
22+
- name: Build
23+
run: pipx run build
24+
25+
- uses: actions/upload-artifact@v3
26+
with:
27+
path: |
28+
dist/*.tar.gz
29+
dist/*.whl
30+
31+
upload_pypi:
32+
needs: build
33+
runs-on: ubuntu-latest
34+
environment: release
35+
permissions:
36+
id-token: write
37+
if: github.event_name == 'release' && github.event.action == 'published'
38+
steps:
39+
- uses: actions/download-artifact@v3
40+
with:
41+
name: artifact
42+
path: dist
43+
44+
- uses: pypa/gh-action-pypi-publish@release/v1

dev-bin/release.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ version="${BASH_REMATCH[1]}"
2121
date="${BASH_REMATCH[2]}"
2222
notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^[0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')"
2323

24-
if [[ "$date" != "$(date +"%Y-%m-%d")" ]]; then
24+
if [[ "$date" != "$(date +"%Y-%m-%d")" ]]; then
2525
echo "$date is not today!"
2626
exit 1
2727
fi
@@ -33,14 +33,11 @@ if [ -n "$(git status --porcelain)" ]; then
3333
exit 1
3434
fi
3535

36-
# Make sure Sphinx and wheel are installed with the current python
37-
pip install sphinx wheel
38-
3936
perl -pi -e "s/(?<=__version__ = \").+?(?=\")/$version/gsm" geoip2/__init__.py
4037
perl -pi -e "s/(?<=^version = \").+?(?=\")/$version/gsm" pyproject.toml
4138

4239
echo $"Test results:"
43-
python setup.py test
40+
tox
4441

4542
echo $'\nDiff:'
4643
git diff
@@ -62,8 +59,3 @@ git push
6259
gh release create --target "$(git branch --show-current)" -t "$version" -n "$notes" "$tag"
6360

6461
git push --tags
65-
66-
rm -fr build dist
67-
python -m sphinx -M html ./docs ./build/sphinx
68-
python -m pipx run build
69-
twine upload dist/*

0 commit comments

Comments
 (0)