| 1 |
name: Release Package |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
# Sequence of patterns matched against refs/tags |
| 6 |
tags: |
| 7 |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 8 |
workflow_dispatch: |
| 9 |
inputs: |
| 10 |
version: |
| 11 |
description: Manual Release |
| 12 |
default: test |
| 13 |
required: false |
| 14 |
|
| 15 |
jobs: |
| 16 |
build: |
| 17 |
runs-on: ubuntu-latest |
| 18 |
permissions: |
| 19 |
id-token: write # MANDATORY for trusted publishing to PyPI |
| 20 |
contents: write # MANDATORY for the Github release action |
| 21 |
|
| 22 |
steps: |
| 23 |
- uses: actions/checkout@v6 |
| 24 |
- name: Set up Python |
| 25 |
uses: actions/setup-python@v6 |
| 26 |
with: |
| 27 |
python-version: '3.x' |
| 28 |
|
| 29 |
- name: Build source and wheel distributions |
| 30 |
run: | |
| 31 |
python -m pip install --upgrade build twine |
| 32 |
python -m build |
| 33 |
twine check --strict dist/* |
| 34 |
|
| 35 |
- name: Create Release Notes |
| 36 |
uses: actions/github-script@v8 |
| 37 |
with: |
| 38 |
github-token: ${{secrets.GITHUB_TOKEN}} |
| 39 |
script: | |
| 40 |
await github.request(`POST /repos/${{ github.repository }}/releases`, { |
| 41 |
tag_name: "${{ github.ref }}", |
| 42 |
generate_release_notes: true |
| 43 |
}); |
| 44 |
|
| 45 |
- name: Publish distribution 📦 to PyPI |
| 46 |
uses: pypa/gh-action-pypi-publish@release/v1 |