Skip to content

Commit b6a1426

Browse files
committed
feat: added github workflow to build apps
1 parent 028d4d2 commit b6a1426

1 file changed

Lines changed: 128 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Build and Publish LanSync
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release Version (e.g., v1.0.0)'
8+
required: true
9+
default: 'v1.0.0'
10+
11+
jobs:
12+
build-desktop:
13+
name: Build Desktop (${{ matrix.artifact_name }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
include:
18+
- os: windows-latest
19+
platform: windows/amd64
20+
artifact_name: windows-amd64
21+
build_flags: '-nsis' # Generates a nice Windows installer
22+
- os: macos-latest
23+
platform: darwin/amd64
24+
artifact_name: macos-amd64
25+
build_flags: ''
26+
- os: macos-latest
27+
platform: darwin/arm64 # Apple Silicon (M1...M5)
28+
artifact_name: macos-arm64
29+
build_flags: ''
30+
- os: ubuntu-latest
31+
platform: linux/amd64
32+
artifact_name: linux-amd64
33+
build_flags: ''
34+
35+
steps:
36+
- name: Checkout Code
37+
uses: actions/checkout@v4
38+
39+
- name: Setup Go
40+
uses: actions/setup-go@v5
41+
with:
42+
go-version: '1.26'
43+
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: '18'
48+
49+
- name: Install Linux Dependencies
50+
if: runner.os == 'Linux'
51+
run: |
52+
sudo apt-get update
53+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev
54+
55+
- name: Install Wails CLI
56+
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
57+
58+
- name: Build Wails App
59+
working-directory: ./desktop
60+
run: wails build -platform ${{ matrix.platform }} ${{ matrix.build_flags }}
61+
62+
- name: Upload Desktop Artifacts
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: ${{ matrix.artifact_name }}
66+
path: desktop/build/bin/*
67+
68+
build-android:
69+
name: Build Android APK
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout Code
73+
uses: actions/checkout@v4
74+
75+
- name: Setup Java JDK
76+
uses: actions/setup-java@v4
77+
with:
78+
distribution: 'zulu'
79+
java-version: '17'
80+
81+
- name: Make Gradle executable
82+
working-directory: ./mobile
83+
run: chmod +x ./gradlew
84+
85+
- name: Build Release APK
86+
working-directory: ./mobile
87+
run: ./gradlew assembleRelease
88+
89+
- name: Upload Android Artifact
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: android-apk
93+
path: mobile/app/build/outputs/apk/release/*.apk
94+
95+
publish:
96+
name: Publish Release
97+
needs: [build-desktop, build-android]
98+
runs-on: ubuntu-latest
99+
permissions:
100+
contents: write # CRITICAL: Allows GitHub Actions to create the release
101+
steps:
102+
- name: Download all artifacts
103+
uses: actions/download-artifact@v4
104+
with:
105+
path: artifacts
106+
107+
- name: Prepare Assets for Release
108+
run: |
109+
# Mac apps are technically folders (.app). We MUST zip them for download.
110+
cd artifacts/macos-amd64 && zip -qr ../../LanSync-macOS-Intel.zip . && cd ../../
111+
cd artifacts/macos-arm64 && zip -qr ../../LanSync-macOS-AppleSilicon.zip . && cd ../../
112+
113+
# Linux binaries lose executable permissions if not tarballed
114+
cd artifacts/linux-amd64 && tar -czvf ../../LanSync-Linux-amd64.tar.gz . && cd ../../
115+
116+
- name: Create GitHub Release
117+
uses: softprops/action-gh-release@v1
118+
with:
119+
tag_name: ${{ github.event.inputs.version }}
120+
name: LanSync ${{ github.event.inputs.version }}
121+
draft: false
122+
prerelease: false
123+
files: |
124+
LanSync-macOS-Intel.zip
125+
LanSync-macOS-AppleSilicon.zip
126+
LanSync-Linux-amd64.tar.gz
127+
artifacts/windows-amd64/*.exe
128+
artifacts/android-apk/*.apk

0 commit comments

Comments
 (0)