-
Notifications
You must be signed in to change notification settings - Fork 2.4k
92 lines (77 loc) · 2.46 KB
/
Copy pathpython-package.yaml
File metadata and controls
92 lines (77 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Publish Python package
on:
release:
types: [published]
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@v7
with:
ref: ${{ github.event.inputs.commit }}
fetch-depth: 0
filter: blob:none
persist-credentials: false
- name: Set up uv and Python
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: "3.10"
cache-dependency-glob: "pyproject.toml"
- uses: actions/setup-node@v7
with:
node-version-file: ".nvmrc"
cache-dependency-path: "**/package-lock.json"
- name: Install python packages
run: |
uv sync --only-dev --locked
- name: Build UI bundles
env:
VITE_AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
run: |
uv run prefect dev build-ui --include-v2
- name: Check git diff
run: |
git diff --exit-code
- name: Build a binary wheel and a source tarball
env:
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
PREFECT_REQUIRE_PACKAGED_UI_BUNDLES: "1"
run: |
uv build --sdist --wheel --out-dir dist
- name: Publish build artifacts
uses: actions/upload-artifact@v7
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@v8
with:
name: pypi-dists
path: "./dist"
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1