Reworked how github release is made #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Release package | |
on: | |
push: | |
tags: | |
- "*.*.*" | |
permissions: | |
contents: write | |
jobs: | |
pypi: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine hatch hatch-vcs | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python -m build | |
python -m twine upload dist/* | |
- name: Create GitHub release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git fetch --tags --force | |
git tag -l --format='%(contents:subject)' > release_notes.md | |
gh release create ${{ github.ref }} --title ${{ github.ref_name }} --notes-file release_notes.md --draft | |
gh release upload ${{ github.ref }} dist/* | |
gh release edit ${{ github.ref }} --draft=false |