1+ name : Build and Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ permissions :
9+ contents : write
10+ packages : read
11+
12+ jobs :
13+ build-windows :
14+ runs-on : windows-latest
15+ steps :
16+ - name : Check out Git repository
17+ uses : actions/checkout@v4
18+
19+ - name : Install Node.js
20+ uses : actions/setup-node@v4
21+ with :
22+ node-version : 18
23+
24+ - name : Install dependencies
25+ run : npm install
26+
27+ - name : Prepare build
28+ run : node scripts/prepare-build.js windows
29+
30+ - name : Build CSS
31+ run : npm run build:css
32+
33+ - name : Build Webpack
34+ run : npm run build:webpack
35+
36+ - name : Build Windows Package
37+ run : npm run build:win -- --publish=never
38+ env :
39+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
40+
41+ - name : Upload Windows Artifacts
42+ uses : actions/upload-artifact@v4
43+ with :
44+ name : windows-artifacts
45+ path : dist/*.exe
46+ retention-days : 5
47+
48+ build-linux :
49+ runs-on : ubuntu-latest
50+ steps :
51+ - name : Check out Git repository
52+ uses : actions/checkout@v4
53+
54+ - name : Install Node.js
55+ uses : actions/setup-node@v4
56+ with :
57+ node-version : 18
58+
59+ - name : Install dependencies
60+ run : npm install
61+
62+ - name : Install required system packages
63+ run : |
64+ sudo apt-get update
65+ sudo apt-get install -y libgtk-3-dev libnotify-dev libnss3 libxss1 libgbm-dev
66+
67+ # Skip prepare-build for Linux as it seems to be causing issues
68+ # Instead, directly modify package.json for Linux build
69+
70+ - name : Configure Linux Build
71+ run : |
72+ # Create a minimal electron-builder config for Linux
73+ node -e "
74+ const fs = require('fs');
75+ const path = require('path');
76+ const packageJsonPath = path.join(process.cwd(), 'package.json');
77+ const packageJson = require(packageJsonPath);
78+
79+ // Remove any existing Linux configuration
80+ if (packageJson.build && packageJson.build.linux) {
81+ delete packageJson.build.linux;
82+ }
83+
84+ // Set minimal Linux config without any icon reference
85+ if (!packageJson.build) packageJson.build = {};
86+ packageJson.build.linux = {
87+ target: ['AppImage'],
88+ category: 'Utility'
89+ };
90+
91+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
92+ "
93+
94+ - name : Build CSS
95+ run : npm run build:css
96+
97+ - name : Build Webpack
98+ run : npm run build:webpack
99+
100+ - name : Build Linux AppImage
101+ run : npm run build -- --linux AppImage --publish=never
102+ env :
103+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
104+
105+ - name : Upload Linux Artifacts
106+ uses : actions/upload-artifact@v4
107+ with :
108+ name : linux-artifacts
109+ path : dist/*.AppImage
110+ retention-days : 5
111+
112+ build-macos :
113+ runs-on : macos-latest
114+ steps :
115+ - name : Check out Git repository
116+ uses : actions/checkout@v4
117+
118+ - name : Install Node.js
119+ uses : actions/setup-node@v4
120+ with :
121+ node-version : 18
122+
123+ - name : Install dependencies
124+ run : npm install
125+
126+ - name : Prepare build
127+ run : node scripts/prepare-build.js mac
128+
129+ - name : Build CSS
130+ run : npm run build:css
131+
132+ - name : Build Webpack
133+ run : npm run build:webpack
134+
135+ - name : Build macOS Universal Binary
136+ run : npm run build:mac-universal -- --publish=never
137+ env :
138+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
139+
140+ - name : Upload macOS Artifacts
141+ uses : actions/upload-artifact@v4
142+ with :
143+ name : macos-artifacts
144+ path : |
145+ dist/*.dmg
146+ dist/*.zip
147+ retention-days : 5
148+
149+ create-release :
150+ needs : [build-windows, build-linux, build-macos]
151+ runs-on : ubuntu-latest
152+ steps :
153+ - name : Check out Git repository
154+ uses : actions/checkout@v4
155+ with :
156+ fetch-depth : 0
157+
158+ - name : Get version from tag
159+ id : get_version
160+ run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
161+
162+ - name : Get Changelog Entry
163+ id : changelog_reader
164+ uses : mindsers/changelog-reader-action@v2
165+ with :
166+ validation_level : warn
167+ path : ./CHANGELOG.md
168+ version : ${{ steps.get_version.outputs.VERSION }}
169+ continue-on-error : true
170+
171+ - name : Download Windows artifacts
172+ uses : actions/download-artifact@v4
173+ with :
174+ name : windows-artifacts
175+ path : artifacts
176+
177+ - name : Download Linux artifacts
178+ uses : actions/download-artifact@v4
179+ with :
180+ name : linux-artifacts
181+ path : artifacts
182+
183+ - name : Download macOS artifacts
184+ uses : actions/download-artifact@v4
185+ with :
186+ name : macos-artifacts
187+ path : artifacts
188+
189+ - name : Create Release
190+ uses : softprops/action-gh-release@v1
191+ with :
192+ name : Release ${{ steps.get_version.outputs.VERSION }}
193+ body : ${{ steps.changelog_reader.outputs.changes || 'No changelog provided' }}
194+ draft : true
195+ files : |
196+ artifacts/*
197+ env :
198+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments