Skip to content

PyPI publish on release #1

PyPI publish on release

PyPI publish on release #1

Workflow file for this run

name: PyPI publish on release
on:
release:
types: [published]
defaults:
run:
shell:
bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify tag matches version
run: |
set -ex
version=$(grep -m 1 version pyproject.toml | grep -P '\d+\.\d+\.\d+' -o)
tag="${GITHUB_REF/refs\/tags\/}"
if [[ "v$version" != "$tag" ]]; then
exit 1
fi
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.27"
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- name: Set up Python
run: uv python install
- name: Build sdist and wheel
run: uv build
- name: Test installation of sdist and wheel
run: |
uv venv --no-project
uv pip install dist/*.tar.gz
uv pip install dist/*.whl
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/coqpit*
publish-artifacts:
runs-on: ubuntu-latest
needs: [build]
environment:
name: release
url: https://pypi.org/p/coqpit-config
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: "dist"
path: "dist/"
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1