-
Notifications
You must be signed in to change notification settings - Fork 0
323 lines (281 loc) · 10.2 KB
/
linux.yml
File metadata and controls
323 lines (281 loc) · 10.2 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
name: Linux Build
on:
# push:
# branches: [ main ]
# pull_request:
workflow_dispatch:
workflow_call:
jobs:
build-deb:
name: Build DEB
runs-on: ubuntu-latest
container:
image: ubuntu:20.04
steps:
- name: Install core tools
run: |
apt-get update
apt-get install -y curl git tar xz-utils libglu1-mesa file
- name: Checkout repository
uses: actions/checkout@v6
- name: Fix webview_cef paths for DEB
run: |
ln -s runner/my_application.cc linux/my_application.cc
ln -s runner/main.cc linux/main.cc
- name: Install Linux dependencies (Ubuntu)
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y \
clang \
cmake \
ninja-build \
pkg-config \
libgtk-3-dev \
liblzma-dev \
libappindicator3-dev \
libnss3-dev \
libnspr4-dev \
libasound2-dev \
xclip \
sudo
- name: Install Flutter
run: |
curl -o /tmp/flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.41.4-stable.tar.xz
mkdir -p /opt
tar -xf /tmp/flutter.tar.xz -C /opt
rm /tmp/flutter.tar.xz
git config --global --add safe.directory /opt/flutter
echo "/opt/flutter/bin" >> $GITHUB_PATH
- name: Build DEB package
run: |
export PATH="$PATH:/opt/flutter/bin"
/opt/flutter/bin/dart pub global activate fastforge
/opt/flutter/bin/flutter pub get
/opt/flutter/bin/dart pub global run fastforge:main package --platform linux --targets deb
- name: Upload DEB artifact
uses: actions/upload-artifact@v6
with:
name: deb-package
path: dist/*/*.deb
- name: Prepare and rename DEB
run: |
VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2)
mkdir -p deploy_out
DEB_FILE=$(find dist/ -name "*.deb" | head -n 1)
if [ -f "$DEB_FILE" ]; then
cp "$DEB_FILE" "deploy_out/lsfusion-client-$VERSION.deb"
fi
- name: Upload DEB to CDN via FTP
uses: sand4rt/ftp-deployer@v1.8
with:
host: ${{ secrets.SFTP_HOST }}
username: ${{ secrets.SFTP_USERNAME }}
password: ${{ secrets.SFTP_PASSWORD }}
local_folder: deploy_out/
remote_folder: flutter/linux/
cleanup: false
build-rpm:
name: Build RPM
runs-on: ubuntu-latest
container:
image: almalinux:8
steps:
- name: Install core tools
run: dnf install -y git tar xz which curl
- name: Checkout repository
uses: actions/checkout@v6
- name: Fix webview_cef paths for RPM
run: |
ln -s runner/my_application.cc linux/my_application.cc
ln -s runner/main.cc linux/main.cc
- name: Enable EPEL and PowerTools
run: |
dnf install -y epel-release
dnf install -y 'dnf-command(config-manager)'
dnf config-manager --set-enabled powertools
- name: Install build dependencies
run: |
dnf install -y \
clang \
cmake \
ninja-build \
pkg-config \
gtk3-devel \
xz-devel \
libappindicator-gtk3-devel \
rpm-build \
unzip \
libstdc++-devel \
mesa-libGLU-devel \
libX11-devel \
nss-devel \
nspr-devel \
alsa-lib-devel \
xclip
- name: Install Flutter
run: |
curl -o /tmp/flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.41.4-stable.tar.xz
mkdir -p /opt
tar -xf /tmp/flutter.tar.xz -C /opt
rm /tmp/flutter.tar.xz
git config --global --add safe.directory /opt/flutter
echo "/opt/flutter/bin" >> $GITHUB_PATH
- name: Build RPM package
run: |
# Configure RPM build to ignore internal shared libraries
# We use both __requires_exclude and _use_internal_dependency_generator
# Also we disable automatic requirements discovery to avoid finding internal .so
cat <<EOF > $HOME/.rpmmacros
%__requires_exclude ^lib(flutter_.*|printing_plugin|webview_cef_plugin|cef)\\.so.*
%_use_internal_dependency_generator 0
%__find_requires /bin/true
%__find_provides /bin/true
EOF
cp $HOME/.rpmmacros /root/.rpmmacros || true
export PATH="$PATH:/opt/flutter/bin"
/opt/flutter/bin/dart pub global activate fastforge
/opt/flutter/bin/flutter pub get
/opt/flutter/bin/dart pub global run fastforge:main package --platform linux --targets rpm
- name: Upload RPM artifact
uses: actions/upload-artifact@v6
with:
name: rpm-package
path: dist/*/*.rpm
- name: Prepare and rename RPM
run: |
VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2)
mkdir -p deploy_out
RPM_FILE=$(find dist/ -name "*.rpm" | head -n 1)
if [ -f "$RPM_FILE" ]; then
cp "$RPM_FILE" "deploy_out/lsfusion-client-$VERSION.rpm"
fi
- name: Upload RPM to CDN via FTP
uses: sand4rt/ftp-deployer@v1.8
with:
host: ${{ secrets.SFTP_HOST }}
username: ${{ secrets.SFTP_USERNAME }}
password: ${{ secrets.SFTP_PASSWORD }}
local_folder: deploy_out/
remote_folder: flutter/linux/
cleanup: false
build-pacman:
name: Build Arch
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Install core tools
run: |
pacman -Sy --noconfirm archlinux-keyring
pacman -Syu --noconfirm
pacman -S --needed --noconfirm \
base-devel \
clang \
cmake \
ninja \
pkgconf \
gtk3 \
libayatana-appindicator \
nss \
nspr \
alsa-lib \
glu \
libx11 \
xclip \
xz \
zstd \
webkit2gtk-4.1 \
git \
curl \
tar \
which \
sudo
- name: Checkout repository
uses: actions/checkout@v6
- name: Fix webview_cef paths for Arch
run: |
ln -s runner/my_application.cc linux/my_application.cc
ln -s runner/main.cc linux/main.cc
- name: Install Flutter
run: |
curl -o /tmp/flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.41.4-stable.tar.xz
mkdir -p /opt
tar -xf /tmp/flutter.tar.xz -C /opt
rm /tmp/flutter.tar.xz
git config --global --add safe.directory /opt/flutter
echo "/opt/flutter/bin" >> $GITHUB_PATH
- name: Build Arch package
run: |
# Create a non-root user for makepkg
useradd -m builduser
echo "builduser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
chown -R builduser:builduser .
# Run build and packaging as builduser
sudo -u builduser bash <<'EOF'
export PATH="$PATH:/opt/flutter/bin"
# Build the flutter app bundle
flutter pub get
flutter build linux --release
# Extract metadata
VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2 | cut -d '+' -f 1)
PROJECT_DIR=$(pwd)
# Create PKGBUILD
cat > PKGBUILD <<PKGEFF
pkgname=lsfusion-client
pkgver=$VERSION
pkgrel=1
pkgdesc="lsFusion client"
arch=('x86_64')
url="https://lsfusion.org"
license=('MIT')
depends=('gtk3' 'libayatana-appindicator' 'xz' 'nss' 'nspr' 'alsa-lib' 'glu' 'libx11' 'webkit2gtk-4.1')
options=('!strip')
package() {
install -d "\$pkgdir/usr/bin"
install -d "\$pkgdir/usr/share/\$pkgname"
# Copy build bundle from build directory
cp -r "$PROJECT_DIR/build/linux/x64/release/bundle/." "\$pkgdir/usr/share/\$pkgname/"
# Executable symlink (using hyphen for the command name)
ln -s "/usr/share/\$pkgname/lsfusion_client" "\$pkgdir/usr/bin/lsfusion-client"
# Icon
install -Dm644 "$PROJECT_DIR/web/icons/Icon-192.png" "\$pkgdir/usr/share/icons/hicolor/192x192/apps/\$pkgname.png"
# Desktop entry
install -d "\$pkgdir/usr/share/applications"
cat > "\$pkgdir/usr/share/applications/\$pkgname.desktop" <<EOD
[Desktop Entry]
Type=Application
Name=lsFusion client
Exec=lsfusion-client %U
Icon=\$pkgname
Categories=Office;Utility;
Terminal=false
EOD
}
PKGEFF
# Build the package
makepkg -f
EOF
- name: Prepare and rename Arch
run: |
VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2 | cut -d '+' -f 1)
mkdir -p deploy_out
# makepkg produces a file like lsfusion-client-1.0.0-1-x86_64.pkg.tar.zst
ARCH_FILE=$(find . -name "lsfusion-client-*-x86_64.pkg.tar.zst" | head -n 1)
if [ -f "$ARCH_FILE" ]; then
cp "$ARCH_FILE" "deploy_out/lsfusion-client-$VERSION-x86_64.pkg.tar.zst"
fi
- name: Upload Arch artifact
uses: actions/upload-artifact@v6
with:
name: arch-package
path: deploy_out/*.pkg.tar.zst
- name: Upload Arch to CDN via FTP
uses: sand4rt/ftp-deployer@v1.8
with:
host: ${{ secrets.SFTP_HOST }}
username: ${{ secrets.SFTP_USERNAME }}
password: ${{ secrets.SFTP_PASSWORD }}
local_folder: deploy_out/
remote_folder: flutter/linux/
cleanup: false