-
Notifications
You must be signed in to change notification settings - Fork 16
130 lines (119 loc) · 5.19 KB
/
Copy pathlinux_deb-release.yml
File metadata and controls
130 lines (119 loc) · 5.19 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
name: Build Linux (deb) Release
on:
push:
branches: [ main ]
workflow_dispatch:
env:
PICOCLAW_FLUTTER_BUILD_ARGS: >-
--dart-define=PICOCLAW_ANALYTICS_PROVIDER=firebase
--dart-define=PICOCLAW_FIREBASE_APP_ID=${{ secrets.PICOCLAW_FIREBASE_APP_ID }}
--dart-define=PICOCLAW_FIREBASE_API_KEY=${{ secrets.PICOCLAW_FIREBASE_API_KEY }}
--dart-define=PICOCLAW_FIREBASE_PROJECT_ID=${{ secrets.PICOCLAW_FIREBASE_PROJECT_ID }}
--dart-define=PICOCLAW_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.PICOCLAW_FIREBASE_MESSAGING_SENDER_ID }}
--dart-define=PICOCLAW_UMENG_APP_KEY=${{ secrets.PICOCLAW_UMENG_APP_KEY }}
--dart-define=PICOCLAW_UMENG_CHANNEL=${{ secrets.PICOCLAW_UMENG_CHANNEL }}
jobs:
build-linux-deb:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
clang cmake ninja-build pkg-config build-essential \
libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev \
lld binutils libstdc++-12-dev libglu1-mesa
- name: Verify pkg-config modules
run: |
pkg-config --modversion webkit2gtk-4.1 || true
pkg-config --modversion ayatana-appindicator3-0.1 || pkg-config --modversion appindicator3-0.1 || true
- name: Cache pub
uses: actions/cache@v5
with:
path: |
~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
- name: Flutter pub get
run: flutter pub get
- name: Fetch core and build Linux release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
flutter pub run tools/fetch_core_local.dart --repo sipeed/picoclaw --tag latest --out-dir app/bin --platform linux --arch x86_64 --build-mode release --install-to-build || true
flutter build linux --release $PICOCLAW_FLUTTER_BUILD_ARGS
- name: Package Linux as .deb
id: package
run: |
set -e
PKG_NAME=picoclaw_fui
TAG=$(date -u +%y%m%d)-$(git rev-parse --short=6 $GITHUB_SHA)
DEST=${PKG_NAME}-${TAG}-linux-x86_64.deb
PKGROOT=$PWD/pkg_root
rm -rf "$PKGROOT" "$DEST"
BUNDLE_DIR=build/linux/x64/release/bundle
if [ ! -d "$BUNDLE_DIR" ]; then echo "Bundle not found: $BUNDLE_DIR"; ls -la build/linux || true; exit 1; fi
mkdir -p "$PKGROOT/opt/${PKG_NAME}/${TAG}"
cp -r "$BUNDLE_DIR"/* "$PKGROOT/opt/${PKG_NAME}/${TAG}/"
# Include any fetched core binaries installed to app/bin
if [ -d app/bin ]; then
mkdir -p "$PKGROOT/opt/${PKG_NAME}/${TAG}/app/bin"
cp -r app/bin/* "$PKGROOT/opt/${PKG_NAME}/${TAG}/app/bin/" || true
fi
mkdir -p "$PKGROOT/usr/bin"
printf '%s\n' \
'#!/bin/sh' \
'set -e' \
'BASE=/opt/picoclaw_fui' \
'if [ -d "$BASE" ]; then' \
' DIRNAME=$(ls -1 "$BASE" 2>/dev/null | sort -V | tail -n1)' \
' if [ -n "$DIRNAME" ] && [ -d "$BASE/$DIRNAME" ]; then' \
' DIR="$BASE/$DIRNAME"' \
' else' \
' DIR="$BASE"' \
' fi' \
'else' \
' DIR="$BASE"' \
'fi' \
'# Ensure plugin/shared libs in the bundle are discoverable' \
'cd "$DIR" || true' \
'export BASE="$DIR"' \
'export LD_LIBRARY_PATH="$DIR/lib:$DIR/plugins:$LD_LIBRARY_PATH"' \
'exec "$DIR/picoclaw_flutter_ui" "$@"' > "$PKGROOT/usr/bin/${PKG_NAME}"
chmod 0755 "$PKGROOT/usr/bin/${PKG_NAME}"
mkdir -p "$PKGROOT/DEBIAN"
mkdir -p "$PKGROOT/usr/share/icons/hicolor/128x128/apps"
mkdir -p "$PKGROOT/usr/share/applications"
if [ -f assets/app_icon.png ]; then
cp assets/app_icon.png "$PKGROOT/usr/share/icons/hicolor/128x128/apps/picoclaw_fui.png"
fi
printf '%s\n' \
"[Desktop Entry]" \
"Name=PicoClaw FUI" \
"Exec=/usr/bin/picoclaw_fui %U" \
"Icon=picoclaw_fui" \
"Type=Application" \
"Categories=Utility;" \
"Terminal=false" > "$PKGROOT/usr/share/applications/picoclaw_fui.desktop"
printf '%s\n' \
"Package: picoclaw-fui" \
"Version: ${TAG}" \
"Section: utils" \
"Priority: optional" \
"Architecture: amd64" \
"Maintainer: GitHub Actions <actions@github.com>" \
"Description: PicoClaw FUI" > "$PKGROOT/DEBIAN/control"
if command -v gtk-update-icon-cache >/dev/null 2>&1; then
gtk-update-icon-cache -f "$PKGROOT/usr/share/icons/hicolor" || true
fi
dpkg-deb --build "$PKGROOT" "$DEST"
- name: Upload Linux .deb artifact
uses: actions/upload-artifact@v7
with:
name: picoclaw_fui-${{ env.RELEASE_BASE }}-linux-x86_64.deb
path: picoclaw_fui-${{ env.RELEASE_BASE }}-linux-x86_64.deb