Skip to content

Publish to Test PyPI #40

Publish to Test PyPI

Publish to Test PyPI #40

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
- 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 scripts/smoke_test.py
- name: Smoke test (source distribution)
run: uv run --isolated --no-project --with dist/*.tar.gz scripts/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/