Skip to content

Commit

Permalink
feat(linux): arm64 versions (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
gorillamoe committed Jan 22, 2025
1 parent 98ccc5d commit dd0e7cc
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 8 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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",
Expand Down
49 changes: 48 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -56,6 +62,9 @@ set_files_based_on_platform() {
linux)
FILES=("${LINUX_FILES[@]}")
;;
linux-arm64)
FILES=("${LINUX_ARM64_FILES[@]}")
;;
windows)
FILES=("${WINDOWS_FILES[@]}")
;;
Expand Down

0 comments on commit dd0e7cc

Please sign in to comment.