-
Notifications
You must be signed in to change notification settings - Fork 16
451 lines (395 loc) · 16.9 KB
/
Copy pathrelease_full.yml
File metadata and controls
451 lines (395 loc) · 16.9 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
name: Release (build all + publish)
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
jobs:
build-android:
runs-on: ubuntu-latest
environment: production
outputs:
release_base: ${{ steps.vars.outputs.release_base }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install Android command-line tools and SDK components (API 29)
run: |
sudo apt-get update
sudo apt-get install -y unzip wget
ANDROID_SDK_ROOT=$HOME/Android/Sdk
mkdir -p $ANDROID_SDK_ROOT
wget -q https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -O /tmp/cmdline-tools.zip
unzip -q /tmp/cmdline-tools.zip -d /tmp/cmdline-tools
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools/latest
mv /tmp/cmdline-tools/cmdline-tools/* $ANDROID_SDK_ROOT/cmdline-tools/latest/
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
echo "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin" >> $GITHUB_PATH
echo "$ANDROID_SDK_ROOT/platform-tools" >> $GITHUB_PATH
export PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$PATH"
yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT --licenses || true
sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools" "platforms;android-29" "build-tools;29.0.3"
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Cache pub and Gradle
uses: actions/cache@v4
with:
path: |
~/.pub-cache
~/.gradle/caches
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.yaml') }}-${{ hashFiles('**/gradle-wrapper.properties') }}
- name: Flutter pub get
run: flutter pub get
- name: Accept Android SDK licenses
run: |
yes | sdkmanager --licenses || true
- name: Setup Android Signing
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
if [ -n "$KEYSTORE_BASE64" ]; then
echo "$KEYSTORE_BASE64" | base64 -d > android/app/keystore.jks
echo "KEYSTORE_PATH=android/app/keystore.jks" >> $GITHUB_ENV
echo "KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD" >> $GITHUB_ENV
echo "KEY_ALIAS=$KEY_ALIAS" >> $GITHUB_ENV
echo "KEY_PASSWORD=$KEY_PASSWORD" >> $GITHUB_ENV
echo "Android signing configured"
else
echo "No signing configuration found, using debug signature"
fi
- name: Build Android AAB, fetch/install core, and package
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 android --arch arm64 --build-mode release --install-to-build
- name: Build Android APK (release) and fetch/install core
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 android --arch arm64 --build-mode release --install-to-build
- name: Verify APK Signature
if: env.KEYSTORE_PATH != ''
run: |
echo "Verifying APK signature..."
BUILD_TOOLS=$(ls -d $ANDROID_SDK_ROOT/build-tools/*/ | sort -V | tail -n 1)
$BUILD_TOOLS/apksigner verify -v build/app/outputs/flutter-apk/app-release.apk || true
echo "Signature verification completed"
- name: Prepare release metadata
id: vars
run: |
now=$(date -u +%y%m%d)
short=$(git rev-parse --short=6 $GITHUB_SHA)
base_no_prefix="$now-$short"
release_tag="picoclaw_fui-$base_no_prefix"
echo "release_base=$base_no_prefix" >> $GITHUB_OUTPUT
echo "RELEASE_BASE=$base_no_prefix" >> $GITHUB_ENV
echo "RELEASE_TAG=$release_tag" >> $GITHUB_ENV
- name: Collect and rename Android artifacts
run: |
set -e
PKG_NAME=picoclaw_fui
TAG=${RELEASE_BASE}
AAB_NAME=${PKG_NAME}-${TAG}-android-arm_arm64.aab
APK_NAME=${PKG_NAME}-${TAG}-android-universal.apk
rm -f "$AAB_NAME" "$APK_NAME" || true
if ls build/app/outputs/bundle/release/*.aab 1> /dev/null 2>&1; then
cp build/app/outputs/bundle/release/*.aab "$AAB_NAME"
else
echo "AAB not found"; exit 1
fi
if [ -f build/app/outputs/flutter-apk/app-release.apk ]; then
cp build/app/outputs/flutter-apk/app-release.apk "$APK_NAME"
else
echo "Release APK not found"; exit 1
fi
# core binaries are installed into build outputs; avoid uploading app/bin
- name: Upload AAB artifact
uses: actions/upload-artifact@v4
with:
name: picoclaw_fui-${{ env.RELEASE_BASE }}-android-arm_arm64.aab
path: picoclaw_fui-${{ env.RELEASE_BASE }}-android-arm_arm64.aab
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: picoclaw_fui-${{ env.RELEASE_BASE }}-android-universal.apk
path: picoclaw_fui-${{ env.RELEASE_BASE }}-android-universal.apk
- name: Cleanup signing keys
if: always()
run: |
rm -f android/app/keystore.jks
echo "Signing keys cleaned up"
build-macos:
runs-on: macos-latest
needs: []
outputs:
release_base: ${{ steps.vars.outputs.release_base }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Flutter pub get
run: flutter pub get
- name: Build macOS release (build + fetch/install core)
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 macos --arch arm64 --build-mode release --install-to-build
- name: Prepare release metadata
id: vars
run: |
now=$(date -u +%y%m%d)
short=$(git rev-parse --short=6 $GITHUB_SHA)
base_no_prefix="$now-$short"
release_tag="picoclaw_fui-$base_no_prefix"
echo "release_base=$base_no_prefix" >> $GITHUB_OUTPUT
echo "RELEASE_BASE=$base_no_prefix" >> $GITHUB_ENV
echo "RELEASE_TAG=$release_tag" >> $GITHUB_ENV
- name: Package Release (dmg)
run: |
dest="picoclaw_fui-${RELEASE_BASE}-macos-arm64.dmg"
rm -f "$dest" || true
out_dir="build/macos/Build/Products/Release"
if [ ! -d "$out_dir" ]; then
echo "Release output not found"; exit 1
fi
app_path=$(find "$out_dir" -maxdepth 1 -name "*.app" -print -quit)
if [ -z "$app_path" ]; then
echo "No .app found in $out_dir"; ls -la "$out_dir" || true; exit 1
fi
stage_dir=$(mktemp -d)
cp -R "$app_path" "$stage_dir/"
ln -s /Applications "$stage_dir/Applications"
hdiutil create -volname "PicoClawFUI" -srcfolder "$stage_dir" -ov -format UDZO "$dest"
- name: Upload macOS DMG artifact
uses: actions/upload-artifact@v4
with:
name: picoclaw_fui-${{ env.RELEASE_BASE }}-macos-arm64.dmg
path: picoclaw_fui-${{ env.RELEASE_BASE }}-macos-arm64.dmg
build-windows:
runs-on: windows-latest
needs: []
outputs:
release_base: ${{ steps.vars.outputs.release_base }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Flutter pub get
run: flutter pub get
- name: Locate MSBuild and add to PATH
shell: powershell
run: |
Write-Output "Locating MSBuild with vswhere and adding to PATH"
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
if (-not (Test-Path $vswhere)) {
Write-Error "vswhere not found at $vswhere"
exit 1
}
$inst = & $vswhere -latest -requires Microsoft.Component.MSBuild -products * -property installationPath
if (-not $inst) {
Write-Error "Visual Studio with MSBuild not found"
exit 1
}
$msbuildDir = Join-Path $inst 'MSBuild\Current\Bin'
Write-Output "Found MSBuild dir: $msbuildDir"
Add-Content -Path $env:GITHUB_PATH -Value $msbuildDir
- name: Verify VS toolchain
shell: powershell
run: |
Write-Output "--- Verify MSVC / MSBuild / NuGet ---"
msbuild -version
if (Get-Command cl.exe -ErrorAction SilentlyContinue) { cl.exe /? } else { Write-Output 'cl.exe not found' }
if (-not (Get-Command nuget -ErrorAction SilentlyContinue)) { choco install nuget.commandline -y }
nuget help
- name: Build Windows release (build + fetch/install core)
shell: powershell
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 windows --arch x86_64 --build-mode release --install-to-build
- name: Prepare release metadata
id: vars
shell: powershell
run: |
$date = Get-Date -Format 'yyMMdd'
$short = git rev-parse --short=6 $env:GITHUB_SHA
$base_no_prefix = "$date-$short"
$release_tag = "picoclaw_fui-$base_no_prefix"
Add-Content -Path $env:GITHUB_OUTPUT -Value "release_base=$base_no_prefix"
Add-Content -Path $env:GITHUB_ENV -Value "RELEASE_BASE=$base_no_prefix"
Add-Content -Path $env:GITHUB_ENV -Value "RELEASE_TAG=$release_tag"
- name: Zip Release
shell: powershell
run: |
$dest = "picoclaw_fui-${env:RELEASE_BASE}-windows-x64.zip"
Compress-Archive -Path 'build\\windows\\x64\\runner\\Release\\*' -DestinationPath $dest -Force
# core binaries are installed into build outputs; avoid uploading app/bin
- name: Upload Windows ZIP artifact
uses: actions/upload-artifact@v4
with:
name: picoclaw_fui-${{ env.RELEASE_BASE }}-windows-x64.zip
path: picoclaw_fui-${{ env.RELEASE_BASE }}-windows-x64.zip
build-linux:
runs-on: ubuntu-22.04
outputs:
release_base: ${{ steps.vars.outputs.release_base }}
steps:
- name: Checkout
uses: actions/checkout@v4
- 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: Cache pub
uses: actions/cache@v4
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
- name: Prepare release metadata
id: vars
run: |
now=$(date -u +%y%m%d)
short=$(git rev-parse --short=6 $GITHUB_SHA)
base_no_prefix="$now-$short"
release_tag="picoclaw_fui-$base_no_prefix"
echo "release_base=$base_no_prefix" >> $GITHUB_OUTPUT
echo "RELEASE_BASE=$base_no_prefix" >> $GITHUB_ENV
echo "RELEASE_TAG=$release_tag" >> $GITHUB_ENV
- name: Package Linux as .deb
run: |
set -e
PKG_NAME=picoclaw_fui
TAG=${RELEASE_BASE}
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"
# Install icon and desktop entry
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"
# Update icon cache if available (ignore errors)
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@v4
with:
name: picoclaw_fui-${{ env.RELEASE_BASE }}-linux-x86_64.deb
path: picoclaw_fui-${{ env.RELEASE_BASE }}-linux-x86_64.deb
publish:
needs: [build-android, build-windows, build-macos, build-linux]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: downloaded_artifacts
- name: List downloaded files
run: ls -la downloaded_artifacts || true
- name: Move downloaded artifacts to workspace root
run: |
shopt -s globstar || true
find downloaded_artifacts -type f -exec mv -t . {} + || true
- name: Set release vars from build outputs
run: echo "RELEASE_BASE=${{ needs.build-android.outputs.release_base }}" >> $GITHUB_ENV
- name: Publish Release and upload artifacts
uses: ncipollo/release-action@v1
with:
tag: picoclaw_fui-${{ env.RELEASE_BASE }}
name: picoclaw_fui-${{ env.RELEASE_BASE }}
allowUpdates: true
artifacts: |
picoclaw_fui-${{ env.RELEASE_BASE }}-android-arm_arm64.aab
picoclaw_fui-${{ env.RELEASE_BASE }}-android-universal.apk
picoclaw_fui-${{ env.RELEASE_BASE }}-windows-x64.zip
picoclaw_fui-${{ env.RELEASE_BASE }}-macos-arm64.dmg
picoclaw_fui-${{ env.RELEASE_BASE }}-linux-x86_64.deb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}