Skip to content

Commit 48723ec

Browse files
authored
Merge pull request #127 from maxmind/greg/automate-release
Release from GitHub Actions
2 parents e2b69ea + 7822974 commit 48723ec

File tree

2 files changed

+45
-10
lines changed

2 files changed

+45
-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: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +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-
25-
if [[ "$date" != "$(date +"%Y-%m-%d")" ]]; then
24+
if [[ "$date" != "$(date +"%Y-%m-%d")" ]]; then
2625
echo "$date is not today!"
2726
exit 1
2827
fi
@@ -34,9 +33,6 @@ if [ -n "$(git status --porcelain)" ]; then
3433
exit 1
3534
fi
3635

37-
# Make sure release deps are installed with the current python
38-
pip install -U sphinx wheel voluptuous email_validator twine geoip2
39-
4036
perl -pi -e "s/(?<=__version__ = \").+?(?=\")/$version/g" minfraud/version.py
4137
perl -pi -e "s/(?<=^version = \").+?(?=\")/$version/gsm" pyproject.toml
4238

@@ -63,8 +59,3 @@ git push
6359
gh release create --target "$(git branch --show-current)" -t "$version" -n "$notes" "$tag"
6460

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

0 commit comments

Comments
 (0)