Update publish-to-pypi.yml #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPI | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "latest" | |
- name: Build package | |
run: uv build | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version-file: .java-version | |
distribution: temurin | |
- name: Smoke test (wheel) | |
run: uv run --isolated --no-project --with dist/*.whl -- python -c "import pymafia" | |
- name: Smoke test (source distribution) | |
run: uv run --isolated --no-project --with dist/*.tar.gz -- python -c "import pymafia" | |
- name: Upload distributions | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pymafia | |
permissions: | |
# Required for PyPI's trusted publishing | |
id-token: write | |
steps: | |
- name: Download distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Publish to PyPI | |
uses: uv publish --trusted-publishing always |