| 1 |
name: Publish |
| 2 |
# When a GitHub Release is published, upload the pyMBD sdist attached to it to |
| 3 |
# PyPI. Reading the sdist back from the Release keeps PyPI and the Release |
| 4 |
# identical and leaves the Release untouched. |
| 5 |
on: |
| 6 |
release: |
| 7 |
types: [published] |
| 8 |
jobs: |
| 9 |
publish: |
| 10 |
name: Publish to PyPI |
| 11 |
if: github.repository == 'libmbd/libmbd' |
| 12 |
runs-on: ubuntu-latest |
| 13 |
environment: |
| 14 |
name: pypi |
| 15 |
url: https://pypi.org/project/pymbd/ |
| 16 |
permissions: |
| 17 |
id-token: write |
| 18 |
contents: read |
| 19 |
steps: |
| 20 |
# Only the pyMBD sdist; the libMBD archive stays a Release-only asset. |
| 21 |
- name: Download the pyMBD sdist from the Release |
| 22 |
env: |
| 23 |
GH_TOKEN: ${{ github.token }} |
| 24 |
GH_REPO: ${{ github.repository }} |
| 25 |
TAG: ${{ github.event.release.tag_name }} |
| 26 |
run: | |
| 27 |
mkdir -p dist |
| 28 |
gh release download "$TAG" --pattern 'pymbd-*.tar.gz' --dir dist |
| 29 |
- name: Publish to PyPI |
| 30 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 31 |
with: |
| 32 |
skip-existing: true |
| 33 |
packages-dir: dist |