Skip to content

Modernize to use pyproject.toml and drop versioneer (#607) #15

Modernize to use pyproject.toml and drop versioneer (#607)

Modernize to use pyproject.toml and drop versioneer (#607) #15

Workflow file for this run

name: Publish to PyPI
on:
pull_request:
workflow_dispatch:
inputs:
upload_dest:
type: choice
description: Upload wheels to
options:
- No Upload
- PyPI
- Test PyPI
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
permissions: {}
jobs:
build-artifacts:
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.9"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build wheel and sdist
run: python -m build
- uses: actions/upload-artifact@v4
with:
name: releases
path: dist
if-no-files-found: error
- name: Check with twine
run: python -m twine check --strict dist/*
upload-to-test-pypi:
needs: build-artifacts
runs-on: ubuntu-latest
if: github.repository == 'pytoolz/toolz' && (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' && github.event.inputs.upload_dest == 'Test PyPI')
environment:
name: test-pypi
url: https://test.pypi.org/p/toolz
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v5
with:
name: releases
path: dist
- name: Publish to Test-PyPI
uses: pypa/[email protected]
with:
print-hash: true
verbose: true
upload-to-pypi:
needs: build-artifacts
runs-on: ubuntu-latest
if: github.repository == 'pytoolz/toolz' && startsWith(github.ref, 'refs/tags/') && (github.event_name != 'workflow_dispatch' || github.event.inputs.upload_dest == 'PyPI')
environment:
name: pypi
url: https://pypi.org/p/toolz
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v5
with:
name: releases
path: dist
- name: Publish to PyPI
uses: pypa/[email protected]
with:
print-hash: true
verbose: true