Skip to content

Commit 94aa46b

Browse files
feat: add tag-triggered release workflow for wheel, sdist and Windows bundle
1 parent b2a4d0d commit 94aa46b

3 files changed

Lines changed: 133 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Release
2+
3+
# Fires when an annotated version tag is pushed (for example v0.2.1).
4+
# Builds hatchling wheel + sdist and a Windows PyInstaller zip, then attaches
5+
# all three as GitHub Release assets via softprops/action-gh-release.
6+
#
7+
# Expected asset names (version comes from pyproject.toml at the tagged commit):
8+
# cppa_cursor_browser-<version>-py3-none-any.whl (~154 KiB at 0.2.0)
9+
# cppa_cursor_browser-<version>.tar.gz (~225 KiB at 0.2.0)
10+
# CursorChatBrowser-windows.zip (PyInstaller onedir bundle)
11+
#
12+
# Fork verification: push a test tag (for example v0.0.0-test) and confirm the
13+
# workflow attaches all three files to the resulting Release.
14+
15+
on:
16+
push:
17+
tags:
18+
- "v*"
19+
20+
permissions:
21+
contents: write
22+
23+
concurrency:
24+
group: release-${{ github.ref }}
25+
cancel-in-progress: false
26+
27+
jobs:
28+
build-python:
29+
name: Build wheel and sdist
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
with:
34+
persist-credentials: false
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
38+
with:
39+
python-version: "3.12"
40+
41+
- name: Build hatchling distributables
42+
run: |
43+
python -m pip install --upgrade pip
44+
python -m pip install 'build>=1,<2'
45+
python -m build
46+
47+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
48+
with:
49+
name: python-distributables
50+
path: |
51+
dist/*.whl
52+
dist/*.tar.gz
53+
if-no-files-found: error
54+
55+
build-windows:
56+
name: Build Windows PyInstaller bundle
57+
runs-on: windows-latest
58+
steps:
59+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60+
with:
61+
persist-credentials: false
62+
63+
- name: Set up Python
64+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
65+
with:
66+
python-version: "3.12"
67+
68+
- name: Install runtime dependencies
69+
# Lock file for Flask/runtime deps; pywebview is the [desktop] extra and
70+
# is required so the published exe can open its native window.
71+
run: |
72+
python -m pip install --upgrade pip
73+
python -m pip install -r requirements-lock.txt
74+
python -m pip install 'pywebview>=5.0,<7'
75+
76+
- name: Install PyInstaller
77+
run: python -m pip install 'pyinstaller>=6,<7'
78+
79+
- name: Build PyInstaller bundle
80+
run: pyinstaller cursor-browser.spec --noconfirm
81+
82+
- name: Smoke-test PyInstaller exe (--help)
83+
run: dist\CursorChatBrowser\CursorChatBrowser.exe --help
84+
85+
- name: Zip onedir bundle
86+
shell: pwsh
87+
run: |
88+
if (-not (Test-Path dist\CursorChatBrowser\CursorChatBrowser.exe)) {
89+
Write-Error "dist\CursorChatBrowser\CursorChatBrowser.exe not found"
90+
exit 1
91+
}
92+
Compress-Archive -Path dist\CursorChatBrowser -DestinationPath CursorChatBrowser-windows.zip
93+
94+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
95+
with:
96+
name: windows-bundle
97+
path: CursorChatBrowser-windows.zip
98+
if-no-files-found: error
99+
100+
publish:
101+
name: Publish GitHub Release assets
102+
needs: [build-python, build-windows]
103+
runs-on: ubuntu-latest
104+
steps:
105+
- name: Download Python distributables
106+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
107+
with:
108+
name: python-distributables
109+
path: release-assets
110+
111+
- name: Download Windows bundle
112+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
113+
with:
114+
name: windows-bundle
115+
path: release-assets
116+
117+
- name: Attach artifacts to Release
118+
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
119+
with:
120+
files: release-assets/*

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ Adding new optional fields to JSON responses, adding new CLI flags with sensible
263263

264264
Notable changes will be documented in **[CHANGELOG.md](CHANGELOG.md)** following the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format.
265265

266+
### GitHub Releases
267+
268+
Pushing an annotated tag matching `v*` (for example `v0.2.1`) runs [`.github/workflows/release.yml`](.github/workflows/release.yml), which attaches three assets to the GitHub Release:
269+
270+
| Asset | Contents |
271+
|---|---|
272+
| `cppa_cursor_browser-<version>-py3-none-any.whl` | Installable wheel (hatchling build) |
273+
| `cppa_cursor_browser-<version>.tar.gz` | Source distribution |
274+
| `CursorChatBrowser-windows.zip` | Windows PyInstaller onedir bundle (`CursorChatBrowser.exe` plus supporting files) |
275+
276+
At `0.2.0`, local `python -m build` produced a ~154 KiB wheel and ~225 KiB sdist; the Windows zip size depends on the locked dependency tree at tag time. Copy release notes from the matching `[version]` section in `CHANGELOG.md` when publishing the GitHub Release.
277+
266278
When an API surface is scheduled for removal, follow the process in **[docs/API_DEPRECATION.md](docs/API_DEPRECATION.md)** (response headers, changelog entries, minimum notice period).
267279

268280
## License

cursor-browser.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ a = Analysis(
1717
(str(src / "static"), "static"),
1818
],
1919
hiddenimports=[
20+
"webview",
2021
"api.workspaces",
2122
"api.composers",
2223
"api.logs",

0 commit comments

Comments
 (0)