diff --git a/.github/scripts/build_appimage.sh b/.github/scripts/build_appimage.sh new file mode 100644 index 0000000..79da058 --- /dev/null +++ b/.github/scripts/build_appimage.sh @@ -0,0 +1,56 @@ +#!/bin/bash +set -e + +ARCH=$(uname -m) +if [ "$ARCH" == "x86_64" ]; then + LINUXDEPLOY_ARCH="x86_64" +elif [ "$ARCH" == "aarch64" ]; then + LINUXDEPLOY_ARCH="aarch64" +else + echo "Unsupported architecture: $ARCH" + exit 1 +fi + +echo "Building AppImage for architecture: $ARCH" + +echo "Downloading linuxdeploy..." +wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${LINUXDEPLOY_ARCH}.AppImage" +chmod +x linuxdeploy-${LINUXDEPLOY_ARCH}.AppImage + +export APPIMAGE_EXTRACT_AND_RUN=1 + +BINARY_PATH="target/release/picoforge" +DESKTOP_FILE="data/in.suyogtandel.picoforge.desktop" +ICON_FILE="static/appIcons/in.suyogtandel.picoforge.svg" + +if [ ! -f "$BINARY_PATH" ]; then + echo "Error: Binary not found at $BINARY_PATH" + exit 1 +fi + +if [ ! -f "$DESKTOP_FILE" ]; then + echo "Error: Desktop file not found at $DESKTOP_FILE" + exit 1 +fi + +if [ ! -f "$ICON_FILE" ]; then + echo "Error: Icon file not found at $ICON_FILE" + exit 1 +fi + +echo "Running linuxdeploy..." +./linuxdeploy-${LINUXDEPLOY_ARCH}.AppImage \ + --appdir AppDir \ + --executable "$BINARY_PATH" \ + --desktop-file "$DESKTOP_FILE" \ + --icon-file "$ICON_FILE" \ + --exclude-library libpcsclite.so.1 \ + --output appimage + +rm "linuxdeploy-${LINUXDEPLOY_ARCH}.AppImage" + +mkdir -p target/release +mv *.AppImage target/release/ + +echo "AppImage build complete. Artifacts moved to target/release/" +ls -l target/release/*.AppImage diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eabc2f2..edde320 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,6 +43,11 @@ jobs: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || matrix.platform == 'windows-latest' && 'x86_64-pc-windows-msvc,i686-pc-windows-msvc,aarch64-pc-windows-msvc' || '' }} + - name: Cache Cargo registry and target + uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.platform }}-${{ matrix.args }} + - name: install dependencies (ubuntu only) if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-24.04-arm' run: | @@ -88,17 +93,25 @@ jobs: echo "version=$version" >> $GITHUB_ENV - name: install cargo-packager - uses: taiki-e/install-action@cargo-packager + uses: taiki-e/install-action@v2 + with: + tool: cargo-packager - name: Build Binary run: cargo build --release ${{ matrix.args }} - # - name: Build and Package (Linux) - # if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-24.04-arm' - # run: cargo packager --release --formats deb,pacman + - name: Build and Package (Linux) + if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-24.04-arm' + run: cargo packager --release --formats deb,pacman + + - name: Build AppImage + if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-24.04-arm' + run: | + chmod +x .github/scripts/build_appimage.sh + ./.github/scripts/build_appimage.sh - name: Build and Package - # if: matrix.platform != 'ubuntu-22.04' && matrix.platform != 'ubuntu-24.04-arm' + if: matrix.platform != 'ubuntu-22.04' && matrix.platform != 'ubuntu-24.04-arm' run: cargo packager --release ${{ matrix.args }} - name: Upload Release Assets @@ -118,7 +131,6 @@ jobs: target/release/*.AppImage target/release/*.tar.gz target/release/*.msi - target/release/*.exe target/release/*.dmg target/release/*.app target/x86_64-apple-darwin/release/*.dmg