-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (114 loc) · 4.29 KB
/
Copy pathrelease.yml
File metadata and controls
134 lines (114 loc) · 4.29 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Release
# v* tag push: build wheel, sdist, and Windows zip; publish attaches all three to the Release.
# workflow_dispatch runs the build jobs only (no publish).
#
# Asset names (version from pyproject.toml at the tagged commit):
# cppa_cursor_browser-<version>-py3-none-any.whl (~154 KiB at 0.2.0)
# cppa_cursor_browser-<version>.tar.gz (~225 KiB at 0.2.0)
# CursorChatBrowser-windows.zip
#
# Fork check: push v0.0.0-test and confirm all three files on the Release.
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build-python:
name: Build wheel and sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- name: Build hatchling distributables
run: |
python -m pip install --upgrade pip
python -m pip install 'build>=1,<2'
python -m build
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: python-distributables
path: |
dist/*.whl
dist/*.tar.gz
if-no-files-found: error
build-windows:
name: Build Windows PyInstaller bundle
runs-on: windows-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- name: Install runtime dependencies
# requirements-lock.txt for runtime; pywebview for the desktop window.
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-lock.txt
python -m pip install 'pywebview>=5.0,<7'
- name: Install PyInstaller
run: python -m pip install 'pyinstaller>=6,<7'
- name: Build PyInstaller bundle
run: pyinstaller cursor-browser.spec --noconfirm
- name: Smoke-test PyInstaller exe (--help)
run: dist\CursorChatBrowser\CursorChatBrowser.exe --help
- name: Zip onedir bundle
shell: pwsh
run: |
if (-not (Test-Path dist\CursorChatBrowser\CursorChatBrowser.exe)) {
Write-Error "dist\CursorChatBrowser\CursorChatBrowser.exe not found"
exit 1
}
Compress-Archive -Path dist\CursorChatBrowser -DestinationPath CursorChatBrowser-windows.zip
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: windows-bundle
path: CursorChatBrowser-windows.zip
if-no-files-found: error
publish:
name: Publish GitHub Release assets
needs: [build-python, build-windows]
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Python distributables
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: python-distributables
path: release-assets
- name: Download Windows bundle
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: windows-bundle
path: release-assets
- name: Verify release asset set
env:
RELEASE_TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
version="${RELEASE_TAG#v}"
ls -la release-assets/
count=$(find release-assets -maxdepth 1 -type f | wc -l)
test "$count" -eq 3
test -f "release-assets/cppa_cursor_browser-${version}-py3-none-any.whl"
test -f "release-assets/cppa_cursor_browser-${version}.tar.gz"
test -f release-assets/CursorChatBrowser-windows.zip
- name: Attach artifacts to Release
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
with:
files: release-assets/*