From aa9502db7735a21a5631e4396ceb429a3452346c Mon Sep 17 00:00:00 2001 From: Scott Reimers Date: Sun, 19 Apr 2026 16:01:34 -0400 Subject: [PATCH] Add build-appimage.sh and deploy.sh automation scripts build-appimage.sh: builds AppImage + patches out MSDK/VA GStreamer plugins deploy.sh: full build + sign + upload + anchor swap. Credentials loaded from .deploy-creds (gitignored). Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitignore | 1 + build-appimage.sh | 26 +++++++++++++++ deploy.sh | 81 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100755 build-appimage.sh create mode 100644 deploy.sh diff --git a/.gitignore b/.gitignore index 9037517..e09761c 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ CLAUDE.md # Nextcloud sync .sync-exclude.lst *.zip +.deploy-creds diff --git a/build-appimage.sh b/build-appimage.sh new file mode 100755 index 0000000..91422ca --- /dev/null +++ b/build-appimage.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Build AppImage with GStreamer media framework + MSDK/VA patch +# Usage: ./build-appimage.sh +set -e + +echo "=== Building AppImage ===" +cargo tauri build + +echo "=== Patching: removing MSDK/VA plugins ===" +APPDIR="target/release/bundle/appimage/itsgoin.AppDir" +rm -f "$APPDIR"/usr/lib/gstreamer-1.0/libgstmsdk.so +rm -f "$APPDIR"/usr/lib/gstreamer-1.0/libgstva.so + +echo "=== Repackaging AppImage ===" +APPIMAGETOOL=$(find /tmp -name "appimagetool" -executable 2>/dev/null | head -1) +if [ -z "$APPIMAGETOOL" ]; then + echo "ERROR: appimagetool not found in /tmp. It should have been cached by cargo tauri build." + exit 1 +fi + +VERSION=$(grep '"version"' crates/tauri-app/tauri.conf.json | head -1 | sed 's/.*"\([0-9.]*\)".*/\1/') +OUTPUT="target/release/bundle/appimage/itsgoin_${VERSION}_amd64.AppImage" +ARCH=x86_64 "$APPIMAGETOOL" "$APPDIR" "$OUTPUT" + +echo "=== Done: $OUTPUT ===" +ls -lh "$OUTPUT" diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..b79903c --- /dev/null +++ b/deploy.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# Full build + deploy: AppImage, APK, CLI, website, anchor +# Usage: ./deploy.sh +# Requires: cargo, cargo-tauri, Android SDK, sshpass +set -e + +# Load credentials from .deploy-creds (not in git) +if [ -f .deploy-creds ]; then + source .deploy-creds +else + echo "ERROR: .deploy-creds not found. Create it with:" + echo ' SSH_PASS="your-ssh-password"' + echo ' KS_PASS="your-keystore-password"' + exit 1 +fi +SSH_HOST="itsgoin@itsgoin.com" +SSH_OPTS="-o StrictHostKeyChecking=no" +KEYSTORE="itsgoin.keystore" +KS_ALIAS="itsgoin" + +VERSION=$(grep '"version"' crates/tauri-app/tauri.conf.json | head -1 | sed 's/.*"\([0-9.]*\)".*/\1/') +echo "=== Deploying v${VERSION}-beta ===" + +# Build CLI +echo "=== Building CLI ===" +cargo build -p itsgoin-cli --release & +CLI_PID=$! + +# Build APK +echo "=== Building APK ===" +cargo tauri android build --apk & +APK_PID=$! + +# Build AppImage (includes GStreamer patch) +echo "=== Building AppImage ===" +./build-appimage.sh +wait $CLI_PID +echo "=== CLI build complete ===" +wait $APK_PID +echo "=== APK build complete ===" + +# Sign APK +echo "=== Signing APK ===" +UNSIGNED="crates/tauri-app/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk" +ALIGNED="itsgoin-aligned.apk" +SIGNED="itsgoin-${VERSION}-beta.apk" +ZIPALIGN=$(find ~/Android/Sdk/build-tools -name "zipalign" 2>/dev/null | sort -V | tail -1) +APKSIGNER=$(find ~/Android/Sdk/build-tools -name "apksigner" 2>/dev/null | sort -V | tail -1) +"$ZIPALIGN" -f 4 "$UNSIGNED" "$ALIGNED" +"$APKSIGNER" sign --ks "$KEYSTORE" --ks-pass "pass:$KS_PASS" --ks-key-alias "$KS_ALIAS" --out "$SIGNED" "$ALIGNED" +echo "Signed: $SIGNED" + +# Upload (sequential to avoid SSH rate limiting) +echo "=== Uploading website ===" +sshpass -p "$SSH_PASS" scp $SSH_OPTS website/*.html website/style.css "$SSH_HOST:~/public_html/" +sleep 5 + +echo "=== Uploading AppImage ===" +sshpass -p "$SSH_PASS" scp $SSH_OPTS "target/release/bundle/appimage/itsgoin_${VERSION}_amd64.AppImage" "$SSH_HOST:~/public_html/itsgoin_${VERSION}-beta_amd64.AppImage" +sleep 5 + +echo "=== Uploading APK ===" +sshpass -p "$SSH_PASS" scp $SSH_OPTS "$SIGNED" "$SSH_HOST:~/public_html/" +sleep 5 + +echo "=== Uploading CLI ===" +sshpass -p "$SSH_PASS" scp $SSH_OPTS target/release/itsgoin "$SSH_HOST:~/public_html/itsgoin-cli-${VERSION}-beta-linux-amd64" +sleep 5 + +echo "=== Uploading anchor binary ===" +sshpass -p "$SSH_PASS" scp $SSH_OPTS target/release/itsgoin "$SSH_HOST:~/bin/itsgoin.new" +sleep 5 + +echo "=== Swapping anchor ===" +sshpass -p "$SSH_PASS" ssh $SSH_OPTS "$SSH_HOST" 'kill $(cat ~/itsgoin-anchor.pid 2>/dev/null) 2>/dev/null; sleep 1; mv ~/bin/itsgoin.new ~/bin/itsgoin && chmod +x ~/bin/itsgoin && bash ~/bin/start-anchor.sh' +sleep 2 + +echo "=== Verifying anchor ===" +sshpass -p "$SSH_PASS" ssh $SSH_OPTS "$SSH_HOST" 'ps aux | grep "[i]tsgoin.*daemon"' + +echo "=== Deploy complete: v${VERSION}-beta ==="