Skip to content

3.0.5.dev3: Nightly Development Release #144

3.0.5.dev3: Nightly Development Release

3.0.5.dev3: Nightly Development Release #144

Workflow file for this run

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 }}
# Versioneer only generates correct versions with a full fetch
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: "requirements*.txt"
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache-dependency-path: "**/package-lock.json"
- name: Install python packages
run: |
python -m pip install --upgrade pip wheel
pip install --upgrade --upgrade-strategy eager -e .[dev]
- name: Build UI
run: |
prefect dev build-ui
- name: Build a binary wheel and a source tarball
run: |
python setup.py sdist bdist_wheel
- 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