2023-12-19 14:33:19 +00:00
|
|
|
name: Publish Python 🐍 distributions 📦 to PyPI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-12-19 15:16:50 +00:00
|
|
|
branches:
|
|
|
|
- main
|
2023-12-19 14:33:19 +00:00
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-n-publish:
|
|
|
|
name: Build and publish Python 🐍 distributions 📦 to PyPI
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
2023-12-19 15:05:21 +00:00
|
|
|
python-version: 3.8
|
2023-12-19 14:33:19 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install build towncrier
|
|
|
|
|
|
|
|
- name: Generate release notes to "RELEASE_NOTES" Environment Variable
|
|
|
|
run: |
|
|
|
|
echo "RELEASE_NOTES=$(towncrier --draft)" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Generate version notes with towncrier
|
|
|
|
run: |
|
|
|
|
towncrier --yes
|
|
|
|
|
|
|
|
- name: Build a binary wheel and a source tarball
|
|
|
|
run: |
|
|
|
|
cd package
|
|
|
|
python setup.py build
|
|
|
|
|
|
|
|
- name: Publish distribution 📦 to PyPI
|
|
|
|
run: |
|
|
|
|
cd package
|
|
|
|
pip install twine
|
|
|
|
twine upload dist/*
|
|
|
|
env:
|
|
|
|
TWINE_USERNAME: __token__
|
|
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
|
|
|
|
|
|
- name: Create Release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.ref }}
|
|
|
|
release_name: Release ${{ github.ref }}
|
2023-12-19 15:16:50 +00:00
|
|
|
body: ${{ env.RELEASE_NOTES }}
|