3.4.5.dev1: Nightly Development Release #368
Workflow file for this run
This file contains hidden or 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 Python package | |
on: | |
release: | |
types: [released, prereleased] | |
workflow_dispatch: | |
inputs: | |
commit: | |
description: "Commit to build from" | |
required: true | |
default: "main" | |
jobs: | |
build-pypi-dists: | |
name: Build Python package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.commit }} | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Set up uv and Python | |
uses: astral-sh/setup-uv@v6 | |
with: | |
enable-cache: true | |
python-version: "3.9" | |
cache-dependency-glob: "pyproject.toml" | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache-dependency-path: "**/package-lock.json" | |
- name: Install python packages | |
run: | | |
uv sync --only-dev --locked | |
- name: Build UI | |
run: | | |
uv run prefect dev build-ui | |
- name: Check git diff | |
run: | | |
git diff --exit-code | |
- name: Build a binary wheel and a source tarball | |
run: | | |
uv build --sdist --wheel --out-dir dist | |
- name: Publish build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-dists | |
path: "./dist" | |
publish-pypi-dists: | |
name: Publish to PyPI | |
environment: ${{ github.event.release.prerelease && 'pre-release' || 'prod' }} | |
needs: [build-pypi-dists] | |
runs-on: ubuntu-latest | |
permissions: | |
# this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- name: Validate Prerelease Tag | |
if: ${{ github.event_name == 'release' && github.event.release.prerelease == true }} | |
run: | | |
TAG_NAME=${{ github.ref }} | |
if [[ ! "$TAG_NAME" =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+([a-zA-Z0-9]+|\.dev[0-9]+)$ ]]; then | |
echo "Error: Tag $TAG_NAME does not match prerelease version pattern." | |
exit 1 | |
fi | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypi-dists | |
path: "./dist" | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |