| 1 |
name: Publish |
| 2 |
on: |
| 3 |
workflow_dispatch: |
| 4 |
release: |
| 5 |
types: [published] |
| 6 |
|
| 7 |
jobs: |
| 8 |
build: |
| 9 |
runs-on: ubuntu-latest |
| 10 |
steps: |
| 11 |
- uses: actions/checkout@v4 |
| 12 |
- uses: actions/setup-python@v5 |
| 13 |
with: |
| 14 |
python-version: '3.11' |
| 15 |
architecture: x64 |
| 16 |
- name: Build package |
| 17 |
run: | |
| 18 |
python -m pip install --upgrade build |
| 19 |
python -m build |
| 20 |
- name: Store the distribution packages |
| 21 |
uses: actions/upload-artifact@v4 |
| 22 |
with: |
| 23 |
name: python-package-distributions |
| 24 |
path: dist/ |
| 25 |
publish: |
| 26 |
name: Publish to PyPI |
| 27 |
needs: |
| 28 |
- build |
| 29 |
runs-on: ubuntu-latest |
| 30 |
environment: |
| 31 |
name: pypi |
| 32 |
url: https://pypi.org/p/dacite |
| 33 |
permissions: |
| 34 |
id-token: write # IMPORTANT: mandatory for trusted publishing |
| 35 |
steps: |
| 36 |
- name: Download dist |
| 37 |
uses: actions/download-artifact@v4 |
| 38 |
with: |
| 39 |
name: python-package-distributions |
| 40 |
path: dist/ |
| 41 |
- name: Publish package to PyPI |
| 42 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 43 |
with: |
| 44 |
password: ${{ secrets.PYPI_API_TOKEN }} |