| 1 |
# This is a GitHub workflow defining a set of jobs with a set of steps. |
| 2 |
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions |
| 3 |
# |
| 4 |
# Test build release artifacts (PyPI package) and publish them on pushed git |
| 5 |
# tags. |
| 6 |
# |
| 7 |
name: Release |
| 8 |
|
| 9 |
on: |
| 10 |
pull_request: |
| 11 |
paths-ignore: |
| 12 |
- "**.md" |
| 13 |
- ".github/workflows/*" |
| 14 |
- "!.github/workflows/release.yaml" |
| 15 |
push: |
| 16 |
paths-ignore: |
| 17 |
- "**.md" |
| 18 |
- ".github/workflows/*" |
| 19 |
- "!.github/workflows/release.yaml" |
| 20 |
branches-ignore: |
| 21 |
- "dependabot/**" |
| 22 |
- "pre-commit-ci-update-config" |
| 23 |
tags: |
| 24 |
- "**" |
| 25 |
workflow_dispatch: |
| 26 |
|
| 27 |
jobs: |
| 28 |
build-release: |
| 29 |
runs-on: ubuntu-22.04 |
| 30 |
steps: |
| 31 |
- uses: actions/checkout@v6 |
| 32 |
- uses: actions/setup-python@v6 |
| 33 |
with: |
| 34 |
python-version: "3.11" |
| 35 |
|
| 36 |
- name: install build package |
| 37 |
run: | |
| 38 |
pip install --upgrade pip |
| 39 |
pip install build |
| 40 |
pip freeze |
| 41 |
|
| 42 |
- name: build release |
| 43 |
run: | |
| 44 |
python -m build --sdist --wheel . |
| 45 |
ls -l dist |
| 46 |
|
| 47 |
- name: publish to pypi |
| 48 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 49 |
if: startsWith(github.ref, 'refs/tags/') |
| 50 |
with: |
| 51 |
user: __token__ |
| 52 |
password: ${{ secrets.pypi_password }} |