diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index faefce3..f030ca0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,6 +6,51 @@ on: tags: - 'v[0-9]+.[0-9]+.[0-9]+' jobs: + build-linux-arm64: + name: Build Linux ARM64 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up env + run: | + VERSION=${GITHUB_REF_NAME#v} + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "PLATFORM=linux-arm64" >> $GITHUB_ENV + - name: Install OS packages + run: | + sudo apt-get install -y flatpak flatpak-builder && \ + sudo snap install snapcraft --classic && \ + flatpak remote-add \ + --user \ + --if-not-exists \ + flathub https://flathub.org/repo/flathub.flatpakrepo + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + - name: Cache Bun + uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: linux-arm64-bun-${{ hashFiles('**/bun.lockb') }} + restore-keys: | + linux-arm64-bun-${{ hashFiles('**/bun.lockb') }} + - name: Cache Electron + uses: actions/cache@v4 + with: + path: ~/.cache/electron/ + key: linux-arm64-electron-${{ hashFiles('~/.cache/electron/**') }} + restore-keys: | + linux-arm64-electron-${{ hashFiles('~/.cache/electron/**') }} + - name: Install dependencies + run: bun install --frozen-lockfile + - name: Build Linux ARM64 + run: ./scripts/build.sh + - name: Linux Release + run: ./scripts/release.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} build-linux: name: Build Linux runs-on: ubuntu-latest diff --git a/package.json b/package.json index 4b5fb75..fbc9d74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bananas", - "version": "0.0.21", + "version": "0.0.22", "description": "Bananas Screen Sharing is a simple and easy-to-use screen sharing tool for Mac, Windows, and Linux.", "main": "./out/main/index.js", "author": { @@ -21,12 +21,10 @@ "postinstall": "electron-builder install-app-deps", "build:unpack": "bun run build && electron-builder --dir", "build:windows": "bun run build && electron-builder --win --publish never", - "build:macos": "bun run build && electron-builder --mac --publish never", - "build:linux": "bun run build && electron-builder --linux --publish never", - "build:linux:deb": "bun run build && electron-builder --linux deb --publish never", - "build:linux:appimage": "bun run build && electron-builder --linux appImage --publish never", - "build:linux:snap": "bun run build && electron-builder --linux snap --publish never", - "build:linux:flatpak": "bun run build && electron-builder --linux flatpak --publish never", + "build:macos": "./scripts/build.sh PLATFORM=macos", + "build:linux": "./scripts/build.sh PLATFORM=linux", + "build:linux-arm64": "./scripts/build.sh PLATFORM=linux-arm64", + "build:linux-debug": "./scripts/build.sh PLATFORM=linux-debug", "node:packages:update": "ncu -u", "node:packages:upgrade": "ncu -u && bun install", "translations": "typesafe-i18n --no-watch", diff --git a/scripts/build.sh b/scripts/build.sh index e10193e..8b188bf 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -11,4 +11,51 @@ update_package_json_version() { update_package_json_version -bun run "build:$PLATFORM" +build_windows() { + bun run build && ./node_modules/.bin/electron-builder --win --publish never +} + +build_linux() { + bun run build && ./node_modules/.bin/electron-builder --linux --publish never +} + +build_linux_arm64() { + # NOTE: + # One might imagine we could use `electron-builder --arm64` here, but + # it doesn't work as expected. + # There is an issue when building snap packages. + # Instead, we build each target individually. + bun run build && ./node_modules/.bin/electron-builder --linux deb --publish never --arm64 && \ + bun run build && ./node_modules/.bin/electron-builder --linux flatpak --publish never --arm64 && \ + bun run build && ./node_modules/.bin/electron-builder --linux appimage --publish never --arm64 +} + +build_linux_debug() { + bun run build && ./node_modules/.bin/electron-builder --linux deb --publish never +} + +build_macos() { + bun run build && ./node_modules/.bin/electron-builder --mac --publish never +} + +case $PLATFORM in + "linux") + build_linux + ;; + "linux-arm64") + build_linux_arm64 + ;; + "linux-debug") + build_linux_debug + ;; + "macos") + build_macos + ;; + "windows") + build_windows + ;; + *) + echo "Error: PLATFORM $PLATFORM is not supported" + exit 1 + ;; +esac diff --git a/scripts/release.sh b/scripts/release.sh index 5e804e9..f552ec2 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -15,6 +15,12 @@ LINUX_FILES=( "dist/${BIN_NAME}_x86_64.flatpak" ) +LINUX_ARM64_FILES=( + "dist/${BIN_NAME}_arm64.deb" + "dist/${BIN_NAME}_arm64.AppImage" + "dist/${BIN_NAME}_aarch64.flatpak" +) + WINDOWS_FILES=( "dist/${BIN_NAME}-setup_x64.exe" ) @@ -56,6 +62,9 @@ set_files_based_on_platform() { linux) FILES=("${LINUX_FILES[@]}") ;; + linux-arm64) + FILES=("${LINUX_ARM64_FILES[@]}") + ;; windows) FILES=("${WINDOWS_FILES[@]}") ;;