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 2a81734
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 7 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,52 @@ on:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build-linux-arm64:
name: Build Linux ARM64
runs-on: ubuntu-24.04-arm
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 && \
sudo snap install multipass --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
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
32 changes: 32 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,35 @@ update_package_json_version() {
update_package_json_version

bun run "build:$PLATFORM"

# NOTE:
# We leave windows out on purpose.
# We don't have bash on windows,
# so we can't run this script there.
# See <root>/package.json for the windows build command.

case $PLATFORM in
linux)
bun run build && electron-builder --linux --publish never
;;
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 && electron-builder --linux deb --publish never --arm64 && \
bun run build && electron-builder --linux flatpak --publish never --arm64 && \
bun run build && electron-builder --linux appimage --publish never --arm64
;;
linux-debug)
bun run build && electron-builder --linux deb --publish never
;;
macos)
bun run build && electron-builder --mac --publish never
;;
*)
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}_ard64.snap"
"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 2a81734

Please sign in to comment.