-
Notifications
You must be signed in to change notification settings - Fork 0
232 lines (198 loc) · 7.19 KB
/
release.yml
File metadata and controls
232 lines (198 loc) · 7.19 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# Build release artifacts when a version tag is pushed (v*).
# Linux : .deb + tar.gz + AppImage + SHA256SUMS (PySide6, validated).
# Windows: PyInstaller onedir + zip + Inno Setup installer (continue-on-error until CI is stable).
# macOS : PyInstaller .app + zip (continue-on-error, unvalidated without a macOS machine).
#
# workflow_dispatch: manual trigger for CI validation without creating a tag or release.
# Tags with '-' (e.g. v2.0.0-rc1) are published as GitHub pre-releases.
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version to build (e.g. 2.0.0-rc1)"
required: true
default: "2.0.0-dev"
permissions:
contents: write
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.v.outputs.version }}
steps:
- id: v
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
else
ref="${GITHUB_REF_NAME}"
echo "version=${ref#v}" >> "$GITHUB_OUTPUT"
fi
linux:
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y dpkg-dev gettext
- name: Download appimagetool
run: |
arch="$(uname -m)"
mkdir -p tools
wget -q -O "tools/appimagetool-${arch}.AppImage" \
"https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${arch}.AppImage"
chmod +x "tools/appimagetool-${arch}.AppImage"
- name: Build Linux artifacts
run: |
chmod +x packaging/linux/*.sh
./packaging/linux/release.sh "${{ needs.version.outputs.version }}"
- name: Upload Linux artifacts
uses: actions/upload-artifact@v4.6.2
with:
name: linux-${{ needs.version.outputs.version }}
path: |
dist/netneighbor_*.deb
dist/netneighbor-*.tar.gz
dist/NetNeighbor-*.AppImage
dist/SHA256SUMS-*.txt
windows:
needs: version
runs-on: windows-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.6.0
with:
python-version: "3.12"
- name: Install Inno Setup
run: choco install innosetup --no-progress -y
- name: Build Windows bundle
run: |
.\packaging\windows\build.ps1 -Version ${{ needs.version.outputs.version }}
- name: Build Windows installer
run: |
.\packaging\windows\build_installer.ps1 -Version ${{ needs.version.outputs.version }}
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4.6.2
with:
name: windows-${{ needs.version.outputs.version }}
path: dist/NetNeighbor-*-win64-setup.exe
macos-arm64:
needs: version
runs-on: macos-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.6.0
with:
python-version: "3.12"
- name: Install Python dependencies
run: python3 -m pip install -r requirements.txt pyinstaller
- name: Install create-dmg
run: brew install create-dmg
- name: Build macOS arm64 app bundle + DMG
run: |
bash packaging/macos/build_app.sh "${{ needs.version.outputs.version }}" arm64
- name: Smoke test arm64 binary
run: |
APP="dist/NetNeighbor.app/Contents/MacOS/NetNeighbor"
echo "Launching $APP for 5 s..."
"$APP" &
PID=$!
sleep 5
if kill -0 "$PID" 2>/dev/null; then
kill "$PID"
echo "PASS: process still alive after 5 s"
else
wait "$PID"; CODE=$?
# 0 = clean exit, 124 = killed by timeout — both acceptable
if [ "$CODE" -eq 0 ] || [ "$CODE" -eq 124 ]; then
echo "PASS: process exited cleanly (code $CODE)"
else
echo "FAIL: process crashed (exit code $CODE)"
exit 1
fi
fi
- name: Cleanup .app bundle (DMG only in release)
run: rm -rf dist/NetNeighbor.app
- name: Upload macOS arm64 artifacts
uses: actions/upload-artifact@v4.6.2
with:
name: macos-arm64-${{ needs.version.outputs.version }}
path: dist/NetNeighbor-*-macos-arm64.dmg
macos-intel:
needs: version
runs-on: macos-15-intel
continue-on-error: true
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.6.0
with:
python-version: "3.11"
- name: Install Python dependencies
# PySide6 6.5.x is the last series supporting macOS 11 (Big Sur).
# PySide6 6.6+ raised the minimum to macOS 12.
# PySide6 6.5.x requires Python <3.12, so we use Python 3.11.
run: python3 -m pip install "PySide6>=6.5,<6.6" -r requirements.txt pyinstaller
- name: Install create-dmg
run: brew install create-dmg
- name: Build macOS Intel app bundle + DMG
run: |
bash packaging/macos/build_app.sh "${{ needs.version.outputs.version }}" x86_64
- name: Smoke test Intel binary
run: |
APP="dist/NetNeighbor.app/Contents/MacOS/NetNeighbor"
echo "Launching $APP for 5 s..."
"$APP" &
PID=$!
sleep 5
if kill -0 "$PID" 2>/dev/null; then
kill "$PID"
echo "PASS: process still alive after 5 s"
else
wait "$PID"; CODE=$?
if [ "$CODE" -eq 0 ] || [ "$CODE" -eq 124 ]; then
echo "PASS: process exited cleanly (code $CODE)"
else
echo "FAIL: process crashed (exit code $CODE)"
exit 1
fi
fi
- name: Cleanup .app bundle (DMG only in release)
run: rm -rf dist/NetNeighbor.app
- name: Upload macOS Intel artifacts
uses: actions/upload-artifact@v4.6.2
with:
name: macos-intel-${{ needs.version.outputs.version }}
path: dist/NetNeighbor-*-macos-intel.dmg
github-release:
needs: [version, linux, windows, macos-arm64, macos-intel]
runs-on: ubuntu-latest
if: always() && needs.linux.result == 'success' && github.event_name == 'push'
steps:
- uses: actions/download-artifact@v4.3.0
with:
path: release-assets
merge-multiple: true
- name: Flatten release files
run: |
mkdir -p dist-flat
find release-assets -type f \( \
-name '*.deb' -o -name '*.tar.gz' -o -name '*.AppImage' -o \
-name '*.zip' -o -name '*.dmg' -o -name '*.exe' -o -name 'SHA256SUMS-*.txt' \
\) -exec cp {} dist-flat/ \;
- name: Attach to GitHub Release
uses: softprops/action-gh-release@v2.3.2
with:
tag_name: ${{ github.ref_name }}
files: dist-flat/*
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}