Skip to content

Commit

Permalink
Release from GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Nov 14, 2023
1 parent e2b69ea commit 7822974
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and upload to PyPI

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published

jobs:
build:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Build
run: pipx run build

- uses: actions/upload-artifact@v3
with:
path: |
dist/*.tar.gz
dist/*.whl
upload_pypi:
needs: build
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
11 changes: 1 addition & 10 deletions dev-bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ version="${BASH_REMATCH[1]}"
date="${BASH_REMATCH[2]}"
notes="$(echo "${BASH_REMATCH[3]}" | sed -n -E '/^[0-9]+\.[0-9]+\.[0-9]+/,$!p')"


if [[ "$date" != "$(date +"%Y-%m-%d")" ]]; then
if [[ "$date" != "$(date +"%Y-%m-%d")" ]]; then
echo "$date is not today!"
exit 1
fi
Expand All @@ -34,9 +33,6 @@ if [ -n "$(git status --porcelain)" ]; then
exit 1
fi

# Make sure release deps are installed with the current python
pip install -U sphinx wheel voluptuous email_validator twine geoip2

perl -pi -e "s/(?<=__version__ = \").+?(?=\")/$version/g" minfraud/version.py
perl -pi -e "s/(?<=^version = \").+?(?=\")/$version/gsm" pyproject.toml

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

git push --tags

rm -fr build dist
python -m sphinx -M html ./docs ./build/sphinx -W
python -m pipx run build
twine upload dist/*

0 comments on commit 7822974

Please sign in to comment.