-
Notifications
You must be signed in to change notification settings - Fork 131
607 lines (521 loc) · 22 KB
/
Copy pathrelease.yml
File metadata and controls
607 lines (521 loc) · 22 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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.1.0)'
required: true
type: string
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.get_version.outputs.version }}
tag: ${{ steps.get_version.outputs.tag }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get version from input
id: get_version
run: |
VERSION="${{ github.event.inputs.version }}"
# Remove 'v' prefix if present
VERSION="${VERSION#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
# Check if this is a pre-release (alpha or beta)
# Match versions like 1.2.3-alpha, 1.2.3-alpha.1, 1.2.3-beta, 1.2.3-beta.2
if [[ "$VERSION" =~ -(alpha|beta)($|\.) ]]; then
echo "is_prerelease=true" >> $GITHUB_OUTPUT
echo "This is a pre-release version: $VERSION"
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
echo "This is a stable release version: $VERSION"
fi
- name: Check if tag exists
id: check_tag
run: |
git fetch --tags
if git rev-parse ${{ steps.get_version.outputs.tag }} >/dev/null 2>&1; then
echo "tag_exists=true" >> $GITHUB_OUTPUT
echo "Tag ${{ steps.get_version.outputs.tag }} already exists"
else
echo "tag_exists=false" >> $GITHUB_OUTPUT
echo "Tag ${{ steps.get_version.outputs.tag }} does not exist"
fi
- name: Create Git tag
if: steps.check_tag.outputs.tag_exists == 'false'
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git commit -m "Release ${{ steps.get_version.outputs.tag }}" || echo "No changes to commit"
git tag ${{ steps.get_version.outputs.tag }}
git push origin ${{ steps.get_version.outputs.tag }}
git push origin HEAD:${{ github.ref_name }}
- name: Generate changelog
id: changelog
run: |
VERSION="${{ steps.get_version.outputs.version }}"
# Extract changelog for this version from CHANGELOG.md
if [ -f "CHANGELOG.md" ]; then
# Find the section for this version
# Match pattern like "## [1.1.3] - 2025-11-22"
awk -v ver="$VERSION" '
BEGIN { found=0; print_section=0 }
/^## \[/ {
if (print_section) exit
if ($0 ~ "\\[" ver "\\]") {
found=1
print_section=1
next
}
}
print_section && /^## \[/ { exit }
print_section { print }
END {
if (!found) {
print "## What'\''s Changed"
print ""
print "* Release version " ver
}
}
' CHANGELOG.md > RELEASE_NOTES.md
else
# Fallback to git log if CHANGELOG.md doesn't exist
echo "## What's Changed" > RELEASE_NOTES.md
git log $(git describe --tags --abbrev=0 HEAD^)..HEAD --pretty=format:"* %s (%h)" >> RELEASE_NOTES.md || echo "* Initial release" >> RELEASE_NOTES.md
fi
# Show what we extracted for debugging
echo "=== Generated Release Notes ==="
cat RELEASE_NOTES.md
echo "==============================="
- name: Create Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.get_version.outputs.tag }}
name: MrRSS ${{ steps.get_version.outputs.tag }}
body_path: RELEASE_NOTES.md
draft: false
prerelease: ${{ steps.get_version.outputs.is_prerelease == 'true' }}
make_latest: ${{ steps.get_version.outputs.is_prerelease == 'false' }}
token: ${{ secrets.GITHUB_TOKEN }}
build-release:
name: Build ${{ matrix.platform }}-${{ matrix.arch }}
needs: create-release
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
# Desktop platforms - always build
# Linux AMD64 build
- os: ubuntu-24.04
platform: linux
arch: amd64
ext: ''
build_condition: 'true'
# Linux ARM64 build - using native ARM64 runner
- os: ubuntu-24.04-arm
platform: linux
arch: arm64
ext: ''
build_condition: 'true'
# Windows AMD64 build
- os: windows-latest
platform: windows
arch: amd64
ext: '.exe'
build_condition: 'true'
# Windows ARM64 build - using native ARM64 runner
- os: windows-11-arm
platform: windows
arch: arm64
ext: '.exe'
build_condition: 'true'
# macOS Universal build (includes both Intel and Apple Silicon)
- os: macos-latest
platform: darwin
arch: universal
ext: '.app'
build_condition: 'true'
# Mobile platforms - only for Wails v3 (commented out by default)
# Uncomment these when you want to build mobile versions
# - os: macos-latest
# platform: ios
# arch: arm64
# ext: '.ipa'
# build_condition: 'wails_v3_only'
# - os: ubuntu-24.04
# platform: android
# arch: arm64
# ext: '.apk'
# build_condition: 'wails_v3_only'
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.create-release.outputs.tag }}
- name: Check if artifacts already exist
id: check_artifacts
shell: bash
run: |
# Get release info and check for existing assets
TAG="${{ needs.create-release.outputs.tag }}"
VERSION="${{ needs.create-release.outputs.version }}"
# Determine expected artifact names for this platform/arch
if [ "${{ matrix.platform }}" = "windows" ]; then
INSTALLER="MrRSS-${VERSION}-windows-${{ matrix.arch }}-installer.exe"
PACKAGE="" # No package for Windows
elif [ "${{ matrix.platform }}" = "linux" ]; then
INSTALLER="MrRSS-${VERSION}-linux-${{ matrix.arch }}.AppImage"
PACKAGE="MrRSS-${VERSION}-linux-${{ matrix.arch }}.tar.gz"
elif [ "${{ matrix.platform }}" = "darwin" ]; then
INSTALLER="MrRSS-${VERSION}-darwin-${{ matrix.arch }}.dmg"
PACKAGE="" # No package for macOS
elif [ "${{ matrix.platform }}" = "ios" ]; then
INSTALLER="MrRSS-${VERSION}-ios-${{ matrix.arch }}.ipa"
PACKAGE="" # No package for iOS
elif [ "${{ matrix.platform }}" = "android" ]; then
INSTALLER="MrRSS-${VERSION}-android-${{ matrix.arch }}.apk"
PACKAGE="" # No package for Android
fi
# Check if release has these assets
RELEASE_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${TAG}")
ASSETS=$(echo "$RELEASE_JSON" | jq -r '.assets[].name')
echo "Checking for existing assets..."
echo "Expected installer: $INSTALLER"
if [ -n "$PACKAGE" ]; then
echo "Expected package: $PACKAGE"
fi
echo "Found assets:"
echo "$ASSETS"
# Check if any of our artifacts exist
SKIP_BUILD="false"
if echo "$ASSETS" | grep -q "$INSTALLER"; then
echo "Installer for ${{ matrix.platform }}-${{ matrix.arch }} already exists in release"
SKIP_BUILD="true"
elif [ -n "$PACKAGE" ] && echo "$ASSETS" | grep -q "$PACKAGE"; then
echo "Package for ${{ matrix.platform }}-${{ matrix.arch }} already exists in release"
SKIP_BUILD="true"
fi
echo "skip_build=$SKIP_BUILD" >> $GITHUB_OUTPUT
if [ "$SKIP_BUILD" = "true" ]; then
echo "⏭️ Skipping build for ${{ matrix.platform }}-${{ matrix.arch }} (already exists)"
else
echo "✅ Proceeding with build for ${{ matrix.platform }}-${{ matrix.arch }}"
fi
- name: Set up Go
if: steps.check_artifacts.outputs.skip_build == 'false'
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Set up Node.js
if: steps.check_artifacts.outputs.skip_build == 'false'
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install Task (task runner)
if: steps.check_artifacts.outputs.skip_build == 'false'
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Linux dependencies (AMD64)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'linux' && matrix.arch == 'amd64'
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libsoup-3.0-dev \
gcc \
pkg-config \
wget \
file
# Verify webkit2gtk-4.1 is properly installed
pkg-config --modversion webkit2gtk-4.1 || exit 1
echo "webkit2gtk-4.1 installed successfully for Wails v3"
- name: Install Linux dependencies (ARM64)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'linux' && matrix.arch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libsoup-3.0-dev \
gcc \
pkg-config \
wget \
file
# Verify webkit2gtk-4.1 is properly installed
pkg-config --modversion webkit2gtk-4.1 || exit 1
echo "webkit2gtk-4.1 installed successfully for Wails v3 ARM64"
- name: Install Windows dependencies (AMD64)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'windows' && matrix.arch == 'amd64'
run: |
choco install mingw nsis -y
shell: pwsh
- name: Install Windows dependencies (ARM64)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'windows' && matrix.arch == 'arm64'
run: |
choco install mingw nsis -y
# MinGW is required for CGO
shell: pwsh
- name: Install Wails CLI
if: steps.check_artifacts.outputs.skip_build == 'false'
shell: bash
run: go install github.com/wailsapp/wails/v3/cmd/wails3@latest
- name: Install frontend dependencies
if: steps.check_artifacts.outputs.skip_build == 'false'
working-directory: ./frontend
run: npm ci
- name: Build application (Linux)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'linux'
env:
CGO_ENABLED: 1
ARCH: ${{ matrix.arch }}
run: |
# wails3 build via Taskfile automatically handles frontend build
task linux:build
# Verify the build
if [ ! -f "build/bin/MrRSS" ]; then
echo "Error: Binary not found"
exit 1
fi
# Check architecture
file build/bin/MrRSS
echo "Binary built successfully for ${{ matrix.arch }}"
- name: Build application (Windows)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'windows'
shell: pwsh
env:
CGO_ENABLED: 1
ARCH: ${{ matrix.arch }}
run: |
# wails3 build via Taskfile automatically handles frontend build
task windows:build
# Verify the build
if (-not (Test-Path "build/bin/MrRSS.exe")) {
Write-Error "Binary not created"
exit 1
}
Write-Host "Binary built successfully for ${{ matrix.arch }}"
- name: Build application (macOS)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'darwin'
env:
CGO_ENABLED: 1
ARCH: ${{ matrix.arch }}
run: |
# macOS runners can build universal binaries natively
# wails3 build via Taskfile automatically handles frontend build
task darwin:build
- name: Create installer (Windows)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'windows'
run: |
# Find NSIS installation
$nsisPath = Get-Command makensis -ErrorAction SilentlyContinue
if (-not $nsisPath) {
# Try common installation paths
$possiblePaths = @(
"C:\Program Files (x86)\NSIS\makensis.exe",
"C:\Program Files\NSIS\makensis.exe"
)
foreach ($path in $possiblePaths) {
if (Test-Path $path) {
$nsisPath = $path
break
}
}
} else {
$nsisPath = $nsisPath.Source
}
if (-not $nsisPath) {
Write-Error "NSIS not found"
exit 1
}
Write-Host "Using NSIS at: $nsisPath"
# Update version and architecture in installer script
$version = "${{ needs.create-release.outputs.version }}"
$arch = "${{ matrix.arch }}"
$installerPath = "build/windows/installer.nsi"
if (Test-Path $installerPath) {
$content = Get-Content $installerPath -Raw
$content = $content -replace '!define APP_VERSION ".*"', "!define APP_VERSION `"$version`""
$content = $content -replace 'OutFile ".*"', "OutFile `"..\bin\MrRSS-$version-windows-$arch-installer.exe`""
Set-Content $installerPath $content
# Build NSIS installer
& $nsisPath $installerPath
if ($LASTEXITCODE -ne 0) {
Write-Error "NSIS build failed with exit code $LASTEXITCODE"
exit 1
}
} else {
Write-Warning "Installer script not found at $installerPath"
exit 1
}
shell: pwsh
continue-on-error: true
- name: Create portable package (Windows)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'windows'
run: |
$version = "${{ needs.create-release.outputs.version }}"
$arch = "${{ matrix.arch }}"
$portableDir = "build/portable-temp"
# Create portable directory structure
New-Item -ItemType Directory -Force -Path $portableDir | Out-Null
# Copy executable
Copy-Item "build/bin/MrRSS.exe" -Destination $portableDir
# Create portable.txt marker
New-Item -ItemType File -Path "$portableDir/portable.txt" | Out-Null
# Create README for portable version
@"
MrRSS Portable Edition
This is the portable version of MrRSS. All data will be stored in the 'data' folder
next to this executable.
To run: Double-click MrRSS.exe
For more information, visit: https://github.com/WCY-dt/MrRSS
"@ | Out-File -FilePath "$portableDir/README.txt" -Encoding UTF8
# Create zip file
$zipName = "MrRSS-$version-windows-$arch-portable.zip"
Compress-Archive -Path "$portableDir/*" -DestinationPath "build/bin/$zipName" -Force
Write-Host "Created portable package: $zipName"
shell: pwsh
- name: Create installer (Linux)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'linux'
run: |
# Clean up any cached appimagetool to ensure correct architecture is downloaded
rm -f build/appimagetool-*.AppImage
# Debug: Show system architecture info
echo "System architecture: $(uname -m)"
echo "Target architecture: ${{ matrix.arch }}"
# Debug: Verify binary architecture
echo "Binary architecture check:"
file build/bin/MrRSS || true
chmod +x build/linux/create-appimage.sh
ARCH=${{ matrix.arch }} ./build/linux/create-appimage.sh || echo "AppImage creation failed, will use tar.gz"
continue-on-error: true
- name: Create installer (macOS)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'darwin'
run: |
chmod +x build/darwin/create-dmg.sh
./build/darwin/create-dmg.sh
continue-on-error: true
- name: Create portable package (macOS)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'darwin'
run: |
VERSION="${{ needs.create-release.outputs.version }}"
ARCH="${{ matrix.arch }}"
PORTABLE_DIR="build/portable-temp"
# Create portable directory structure
mkdir -p "$PORTABLE_DIR"
# Copy .app bundle
cp -R build/bin/MrRSS.app "$PORTABLE_DIR/"
# Create portable.txt marker
touch "$PORTABLE_DIR/portable.txt"
# Create README for portable version
cat > "$PORTABLE_DIR/README.txt" << 'EOF'
MrRSS Portable Edition
This is the portable version of MrRSS. All data will be stored in the 'data' folder
next to the MrRSS.app.
To run: Double-click MrRSS.app
For more information, visit: https://github.com/WCY-dt/MrRSS
EOF
# Create zip file
cd "$PORTABLE_DIR"
zip -r "../bin/MrRSS-${VERSION}-darwin-${ARCH}-portable.zip" *
cd ../..
echo "Created portable package: MrRSS-${VERSION}-darwin-${ARCH}-portable.zip"
- name: Package application (Linux - tar.gz fallback)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'linux'
run: |
cd build/bin
if [ -f "MrRSS" ]; then
tar -czf MrRSS-${{ needs.create-release.outputs.version }}-linux-${{ matrix.arch }}.tar.gz MrRSS
else
echo "Error: MrRSS binary not found"
exit 1
fi
- name: Create portable package (Linux)
if: steps.check_artifacts.outputs.skip_build == 'false' && matrix.platform == 'linux'
run: |
VERSION="${{ needs.create-release.outputs.version }}"
ARCH="${{ matrix.arch }}"
PORTABLE_DIR="build/portable-temp"
# Create portable directory structure
mkdir -p "$PORTABLE_DIR"
# Copy executable
cp build/bin/MrRSS "$PORTABLE_DIR/"
chmod +x "$PORTABLE_DIR/MrRSS"
# Create portable.txt marker
touch "$PORTABLE_DIR/portable.txt"
# Create README for portable version
cat > "$PORTABLE_DIR/README.txt" << 'EOF'
MrRSS Portable Edition
This is the portable version of MrRSS. All data will be stored in the 'data' folder
next to this executable.
To run: ./MrRSS
For more information, visit: https://github.com/WCY-dt/MrRSS
EOF
# Create tar.gz file
cd "$PORTABLE_DIR"
tar -czf "../bin/MrRSS-${VERSION}-linux-${ARCH}-portable.tar.gz" *
cd ../..
echo "Created portable package: MrRSS-${VERSION}-linux-${ARCH}-portable.tar.gz"
- name: Collect artifacts
if: steps.check_artifacts.outputs.skip_build == 'false'
id: collect_artifacts
shell: bash
run: |
cd build/bin
artifacts=""
# Check for installer and portable package
if [ "${{ matrix.platform }}" = "windows" ]; then
installer="MrRSS-${{ needs.create-release.outputs.version }}-windows-${{ matrix.arch }}-installer.exe"
portable="MrRSS-${{ needs.create-release.outputs.version }}-windows-${{ matrix.arch }}-portable.zip"
if [ -f "$installer" ]; then
artifacts="$artifacts$installer,"
fi
if [ -f "$portable" ]; then
artifacts="$artifacts$portable,"
fi
elif [ "${{ matrix.platform }}" = "linux" ]; then
installer="MrRSS-${{ needs.create-release.outputs.version }}-linux-${{ matrix.arch }}.AppImage"
portable="MrRSS-${{ needs.create-release.outputs.version }}-linux-${{ matrix.arch }}-portable.tar.gz"
if [ -f "$installer" ]; then
artifacts="$artifacts$installer,"
fi
# Check for tar.gz fallback
package="MrRSS-${{ needs.create-release.outputs.version }}-linux-${{ matrix.arch }}.tar.gz"
if [ -f "$package" ]; then
artifacts="$artifacts$package,"
fi
if [ -f "$portable" ]; then
artifacts="$artifacts$portable,"
fi
elif [ "${{ matrix.platform }}" = "darwin" ]; then
installer="MrRSS-${{ needs.create-release.outputs.version }}-darwin-${{ matrix.arch }}.dmg"
portable="MrRSS-${{ needs.create-release.outputs.version }}-darwin-${{ matrix.arch }}-portable.zip"
if [ -f "$installer" ]; then
artifacts="$artifacts$installer,"
fi
if [ -f "$portable" ]; then
artifacts="$artifacts$portable,"
fi
fi
echo "artifacts=$artifacts" >> $GITHUB_OUTPUT
echo "Found artifacts: $artifacts"
- name: Upload Release Assets
if: steps.check_artifacts.outputs.skip_build == 'false'
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.create-release.outputs.tag }}
files: |
build/bin/MrRSS-${{ needs.create-release.outputs.version }}-*
token: ${{ secrets.GITHUB_TOKEN }}
fail_on_unmatched_files: false