Publish to Test PyPI #37
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 Test PyPI | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Package version" | |
type: string | |
env: | |
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ inputs.version }} | |
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 tests/smoke_test.py | |
- name: Smoke test (source distribution) | |
run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py | |
- name: Upload distributions | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.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 Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |