-
Notifications
You must be signed in to change notification settings - Fork 988
76 lines (66 loc) · 2.12 KB
/
release.yml
File metadata and controls
76 lines (66 loc) · 2.12 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
name: Build & Release Wheel
on:
workflow_dispatch:
inputs:
create_release:
description: "Create a GitHub Release with the wheel"
type: boolean
default: false
overwrite_existing:
description: "Overwrite existing release with same version tag"
type: boolean
default: false
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10
- name: Install frontend dependencies
working-directory: frontend
run: pnpm install --frozen-lockfile
- name: Build frontend
working-directory: frontend
run: pnpm build
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build wheel
run: |
pip install build
python -m build --wheel
- name: Create GitHub Release
if: ${{ inputs.create_release }}
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=$(python -c "exec(open('src/magentic_ui/version.py').read()); print(VERSION)")
TAG="v$VERSION"
# Mark as prerelease when the version has an alpha/beta/rc suffix.
PRERELEASE_FLAG=""
if [[ "$VERSION" =~ (a|b|rc)[0-9]+$ ]]; then
PRERELEASE_FLAG="--prerelease"
fi
# Check if release already exists
if gh release view "$TAG" >/dev/null 2>&1; then
if [ "${{ inputs.overwrite_existing }}" != "true" ]; then
echo "::error::Release $TAG already exists. Bump version in version.py or enable 'Overwrite existing release'."
exit 1
fi
echo "Overwriting existing release $TAG..."
gh release delete "$TAG" --yes --cleanup-tag
fi
gh release create "$TAG" dist/*.whl \
--generate-notes \
$PRERELEASE_FLAG