Files

71 lines
2.2 KiB
YAML
Raw Permalink Normal View History

# This workflow will upload a Python Package to PyPI when a release is created
2022-10-10 11:12:22 +00:00
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
2020-02-20 13:59:00 -05:00
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
2019-08-25 01:13:29 +01:00
name: Upload Python Package
on:
release:
types: [published]
2019-08-25 01:13:29 +01:00
2024-03-19 16:41:37 -04:00
permissions:
contents: read
2019-08-25 01:13:29 +01:00
jobs:
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2020-02-21 12:55:06 -05:00
- uses: actions/setup-python@v5
with:
python-version: "3.x"
2024-03-19 15:40:07 -04:00
- name: Build release distributions
run: |
# NOTE: put your own distribution build steps here.
python -m pip install build
python -m build
2024-03-19 15:40:07 -04:00
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
pypi-publish:
2019-08-25 01:13:29 +01:00
runs-on: ubuntu-latest
needs:
- release-build
permissions:
2024-03-19 16:42:35 -04:00
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
2020-02-21 12:55:06 -05:00
2024-03-19 16:57:58 -04:00
# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
environment:
name: pypi
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
# url: https://pypi.org/p/YOURPROJECT
2024-08-20 13:39:26 -04:00
#
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
# ALTERNATIVE: exactly, uncomment the following line instead:
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
2024-03-19 16:57:58 -04:00
2019-08-25 01:13:29 +01:00
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish release distributions to PyPI
2024-11-22 09:48:05 -05:00
uses: pypa/gh-action-pypi-publish@release/v1
2024-11-22 09:47:32 -05:00
with:
packages-dir: dist/