-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.94 KB
/
Copy pathdev-release.yaml
File metadata and controls
60 lines (51 loc) · 1.94 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
name: Dev Release
# AutoGluon-style: publish a `.devN` build to PyPI for every successful push
# to `main`. No git tag, no commit, no GitHub Release — the version is
# computed on the runner and exists only on PyPI.
#
# Gated on the Tests workflow succeeding for that commit, so a broken main
# does not get published.
on:
workflow_run:
workflows: ["Tests"]
types: [completed]
branches: [main]
jobs:
publish-dev:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # (future) PyPI trusted publishing via OIDC
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install 3.11
- name: Compute .dev version
id: ver
run: |
base="$(uv version --short)"
if [[ ! "$base" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::pyproject version '$base' is not a plain X.Y.Z; refusing to derive a dev version"
exit 1
fi
IFS=. read -r major minor patch <<<"$base"
next="${major}.${minor}.$((patch + 1))"
# PEP 440: <next-release>.dev<UTC timestamp>. Sorts before <next-release>
# and after any prior release. Strictly monotonic across commits.
ts="$(date -u +%Y%m%d%H%M%S)"
version="${next}.dev${ts}"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Publishing dev version: $version (base $base, commit ${{ github.event.workflow_run.head_sha }})"
- name: Set version (ephemeral, not committed)
run: uv version "${{ steps.ver.outputs.version }}"
- name: Build sdist + wheel
run: uv build
- name: Publish to PyPI
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: uv publish