-
Notifications
You must be signed in to change notification settings - Fork 0
366 lines (315 loc) · 13 KB
/
Copy pathrelease.yml
File metadata and controls
366 lines (315 loc) · 13 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
name: Release
on:
push:
tags:
- "v*"
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Init build-required submodules
run: git submodule update --init --depth 1 refs/amneziawg-go refs/tailscale-wf
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: ui/frontend/package-lock.json
- name: Extract version from tag
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
# Strip pre-release suffix for NSIS (requires X.X.X numeric format).
NSIS_VERSION="${VERSION%%-*}"
COMMIT="$(git rev-parse --short HEAD)"
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "NSIS_VERSION=$NSIS_VERSION" >> $GITHUB_ENV
echo "COMMIT=$COMMIT" >> $GITHUB_ENV
echo "BUILD_DATE=$DATE" >> $GITHUB_ENV
echo "LDFLAGS=-s -w -X main.version=$VERSION -X main.commit=$COMMIT -X main.buildDate=$DATE" >> $GITHUB_ENV
- name: Install tools
shell: bash
run: |
go install github.com/akavel/rsrc@latest
go install github.com/wailsapp/wails/v3/cmd/wails3@latest
for i in 1 2 3; do choco install nsis -y --no-progress && break || sleep 15; done
- name: Install frontend dependencies
working-directory: ui/frontend
run: npm ci
- name: Generate Wails bindings
working-directory: ui
run: wails3 generate bindings
- name: Build frontend
working-directory: ui/frontend
run: npm run build
- name: Generate Windows resources (.syso)
shell: bash
run: |
ICO="ui/build/windows/icon.ico"
rsrc -manifest cmd/awg-split-tunnel/app.manifest -ico "$ICO" -o cmd/awg-split-tunnel/rsrc_windows_amd64.syso
rsrc -manifest ui/build/windows/wails.exe.manifest -ico "$ICO" -o ui/rsrc_windows_amd64.syso
rsrc -manifest cmd/awg-split-tunnel-updater/app.manifest -ico "$ICO" -o cmd/awg-split-tunnel-updater/rsrc_windows_amd64.syso
rsrc -manifest cmd/awg-diag/app.manifest -ico "$ICO" -o cmd/awg-diag/rsrc_windows_amd64.syso
- name: Download wintun.dll
shell: bash
run: |
curl -fsSL https://www.wintun.net/builds/wintun-0.14.1.zip -o wintun.zip
unzip -j wintun.zip "wintun/bin/amd64/wintun.dll" -d dll/
rm wintun.zip
- name: Build Go binaries
shell: bash
run: |
mkdir -p build
go build -ldflags "$LDFLAGS" -o build/awg-split-tunnel.exe ./cmd/awg-split-tunnel/
go build -ldflags "$LDFLAGS -H windowsgui" -o build/awg-split-tunnel-ui.exe ./ui/
go build -ldflags "$LDFLAGS" -o build/awg-split-tunnel-updater.exe ./cmd/awg-split-tunnel-updater/
go build -ldflags "$LDFLAGS" -o build/awg-split-tunnel-diag.exe ./cmd/awg-diag/
cp dll/wintun.dll build/
- name: Download WebView2 bootstrapper
shell: bash
run: |
curl -fsSL "https://go.microsoft.com/fwlink/p/?LinkId=2124703" \
-o ui/build/windows/nsis/MicrosoftEdgeWebview2Setup.exe
- name: Build NSIS installer
shell: bash
run: |
ABS_SERVICE="$(cygpath -w "$(pwd)/build/awg-split-tunnel.exe")"
ABS_GUI="$(cygpath -w "$(pwd)/build/awg-split-tunnel-ui.exe")"
ABS_UPDATER="$(cygpath -w "$(pwd)/build/awg-split-tunnel-updater.exe")"
ABS_WINTUN="$(cygpath -w "$(pwd)/build/wintun.dll")"
ABS_CONFIG="$(cygpath -w "$(pwd)/config.example.yaml")"
"/c/Program Files (x86)/NSIS/makensis.exe" \
-DARG_WAILS_AMD64_BINARY="$ABS_GUI" \
-DARG_SERVICE_BINARY="$ABS_SERVICE" \
-DARG_UPDATER_BINARY="$ABS_UPDATER" \
-DARG_WINTUN_DLL="$ABS_WINTUN" \
-DARG_CONFIG_EXAMPLE="$ABS_CONFIG" \
-DINFO_PRODUCTVERSION="$NSIS_VERSION" \
ui/build/windows/nsis/project.nsi
- name: Create release ZIP
shell: pwsh
run: |
Compress-Archive -Path `
build/awg-split-tunnel.exe, `
build/awg-split-tunnel-ui.exe, `
build/awg-split-tunnel-updater.exe, `
build/wintun.dll, `
config.example.yaml `
-DestinationPath "build/awg-split-tunnel-v${{ env.VERSION }}-windows-amd64.zip"
- uses: actions/upload-artifact@v7
with:
name: windows-artifacts
path: |
build/awg-split-tunnel-v*-windows-amd64.zip
build/*installer*.exe
retention-days: 5
build-macos:
runs-on: macos-14
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Init build-required submodules
run: git submodule update --init --depth 1 refs/amneziawg-go refs/tailscale-wf
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Extract version
run: |
VERSION="${GITHUB_REF_NAME#v}"
COMMIT="$(git rev-parse --short HEAD)"
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "COMMIT=$COMMIT" >> $GITHUB_ENV
echo "BUILD_DATE=$DATE" >> $GITHUB_ENV
echo "LDFLAGS=-s -w -X main.version=$VERSION -X main.commit=$COMMIT -X main.buildDate=$DATE" >> $GITHUB_ENV
- name: Build daemon binaries
run: |
mkdir -p build
# arm64 (native on macos-14 runner)
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
go build -ldflags "$LDFLAGS" -o build/awg-split-tunnel-arm64 ./cmd/awg-split-tunnel/
# amd64 (cross-compile)
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \
go build -ldflags "$LDFLAGS" -o build/awg-split-tunnel-amd64 ./cmd/awg-split-tunnel/
# Universal binary
lipo -create -output build/awg-split-tunnel \
build/awg-split-tunnel-arm64 build/awg-split-tunnel-amd64
- name: Stage release files
run: |
mkdir -p build/stage
cp scripts/install-daemon.sh scripts/uninstall-daemon.sh build/stage/
cp config.example.yaml build/stage/
- name: Create tarballs
run: |
cd build
for ARCH in arm64 amd64; do
cp "awg-split-tunnel-${ARCH}" stage/awg-split-tunnel
tar czf "awg-split-tunnel-v${VERSION}-darwin-${ARCH}.tar.gz" \
-C stage awg-split-tunnel install-daemon.sh uninstall-daemon.sh config.example.yaml
rm stage/awg-split-tunnel
done
cp awg-split-tunnel stage/awg-split-tunnel
tar czf "awg-split-tunnel-v${VERSION}-darwin-universal.tar.gz" \
-C stage awg-split-tunnel install-daemon.sh uninstall-daemon.sh config.example.yaml
- uses: actions/upload-artifact@v7
with:
name: macos-daemon-artifacts
path: build/awg-split-tunnel-v*-darwin-*.tar.gz
retention-days: 5
build-macos-gui:
runs-on: macos-14
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Init build-required submodules
run: git submodule update --init --depth 1 refs/amneziawg-go refs/tailscale-wf
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: ui/frontend/package-lock.json
- name: Extract version
run: |
VERSION="${GITHUB_REF_NAME#v}"
COMMIT="$(git rev-parse --short HEAD)"
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "LDFLAGS=-s -w -X main.version=$VERSION -X main.commit=$COMMIT -X main.buildDate=$DATE" >> $GITHUB_ENV
- name: Install Wails CLI
run: go install github.com/wailsapp/wails/v3/cmd/wails3@latest
- name: Install frontend dependencies
working-directory: ui/frontend
run: npm ci
- name: Generate Wails bindings
working-directory: ui
run: wails3 generate bindings
- name: Build frontend
working-directory: ui/frontend
run: npm run build
- name: Generate icons
working-directory: ui/build
run: wails3 generate icons -input appicon.png -macfilename darwin/icons.icns -windowsfilename windows/icon.ico || true
- name: Build GUI binaries (CGO required for WKWebView)
working-directory: ui
run: |
mkdir -p bin
BUILD_FLAGS="-tags production -trimpath -buildvcs=false -ldflags=\"$LDFLAGS\""
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 \
go build -tags production -trimpath -buildvcs=false -ldflags "$LDFLAGS" \
-o bin/awg-split-tunnel-gui-arm64 .
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 \
go build -tags production -trimpath -buildvcs=false -ldflags "$LDFLAGS" \
-o bin/awg-split-tunnel-gui-amd64 .
lipo -create -output bin/awg-split-tunnel-gui \
bin/awg-split-tunnel-gui-arm64 bin/awg-split-tunnel-gui-amd64
- name: Create .app bundle
working-directory: ui
run: |
APP="bin/AWG Split Tunnel.app"
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS"
mkdir -p "$APP/Contents/Resources"
cp bin/awg-split-tunnel-gui "$APP/Contents/MacOS/AWG Split Tunnel"
cp build/darwin/icons.icns "$APP/Contents/Resources/appicon.icns" 2>/dev/null || true
cat > "$APP/Contents/Info.plist" << 'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>AWG Split Tunnel</string>
<key>CFBundleIconFile</key>
<string>appicon</string>
<key>CFBundleIdentifier</key>
<string>com.awg.split-tunnel.gui</string>
<key>CFBundleName</key>
<string>AWG Split Tunnel</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
<key>LSUIElement</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
PLIST
- name: Create DMG
working-directory: ui
run: |
hdiutil create -volname "AWG Split Tunnel" \
-srcfolder "bin/AWG Split Tunnel.app" \
-ov -format UDZO \
"bin/AWG-Split-Tunnel-v${VERSION}-darwin-universal.dmg"
- uses: actions/upload-artifact@v7
with:
name: macos-gui-artifacts
path: ui/bin/AWG-Split-Tunnel-v*-darwin-*.dmg
retention-days: 5
create-release:
needs: [build-windows, build-macos, build-macos-gui]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Generate changelog
shell: bash
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
TAG="${GITHUB_REF_NAME}"
if [ -n "$PREV_TAG" ]; then
RANGE="${PREV_TAG}..HEAD"
else
RANGE="HEAD"
fi
echo "# Changelog - ${TAG}" > CHANGELOG.md
echo "" >> CHANGELOG.md
# Process each conventional commit type
for PAIR in "feat:Features" "fix:Bug Fixes" "perf:Performance" "refactor:Refactoring" "docs:Documentation" "test:Tests" "ci:CI" "build:Build"; do
TYPE="${PAIR%%:*}"
LABEL="${PAIR#*:}"
COMMITS=$(git log $RANGE --oneline --no-merges --grep="^${TYPE}" --format="- %s (%h)" 2>/dev/null || true)
if [ -n "$COMMITS" ]; then
echo "## $LABEL" >> CHANGELOG.md
echo "$COMMITS" >> CHANGELOG.md
echo "" >> CHANGELOG.md
fi
done
# Other commits (not matching any type)
OTHER=$(git log $RANGE --oneline --no-merges \
--invert-grep --grep="^feat" --grep="^fix" --grep="^perf" \
--grep="^refactor" --grep="^docs" --grep="^test" --grep="^ci" \
--grep="^build" --format="- %s (%h)" 2>/dev/null || true)
if [ -n "$OTHER" ]; then
echo "## Other" >> CHANGELOG.md
echo "$OTHER" >> CHANGELOG.md
fi
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${{ github.ref_name }}" \
--title "Release ${{ github.ref_name }}" \
--notes-file CHANGELOG.md \
artifacts/*