Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release from GitHub Actions #127

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/*
Loading