Add macOS arm64 binary to the release/download pipeline (#168)

* Add a macos arm64 binary generation and upload step to the deployment workflow

* Add arm64 macos binary support to the install wizard

* Update README.md to mention macOS arm64 binary
This commit is contained in:
Nazım Can Altınova 2026-04-11 14:30:56 +02:00 committed by GitHub
parent e4280e1bec
commit 3190d698d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 76 additions and 39 deletions

View file

@ -27,6 +27,36 @@ jobs:
asset_path: ./bin/tmux-fingers
asset_name: tmux-fingers-${{ github.event.release.tag_name }}-linux-x86_64
asset_content_type: binary/octet-stream
dist_macos_arm64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: "1.14"
- name: Install static lib dependencies
run: brew install bdw-gc pcre2
- name: Prepare static libs
run: |
mkdir -p bin
ln -sf $(brew --prefix bdw-gc)/lib/libgc.a bin/libgc.a
ln -sf $(brew --prefix pcre2)/lib/libpcre2-8.a bin/libpcre2-8.a
- name: Build
run: |
shards build --production --release --no-debug \
--link-flags="-L $(pwd)/bin $(pwd)/bin/libgc.a $(pwd)/bin/libpcre2-8.a"
env:
WIZARD_INSTALLATION_METHOD: download-binary
- name: Upload
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./bin/tmux-fingers
asset_name: tmux-fingers-${{ github.event.release.tag_name }}-macos-arm64
asset_content_type: binary/octet-stream
dist_homebrew:
name: Bump Homebrew formula
runs-on: ubuntu-latest

View file

@ -49,8 +49,8 @@ set -g @plugin 'Morantron/tmux-fingers'
Hit <kbd>prefix</kbd> + <kbd>I</kbd> to fetch and source the plugin. The first time you run it you'll be presented with a wizard to complete the installation. Depending on the platform, the wizard will offer the following installation methods:
- Building from source (requires [crystal](https://crystal-lang.org/install/)). _Available in all platforms_
- Install through [brew](https://brew.sh). _Mac OS only_.
- Download standalone binary. _Linux x86 only_.
- Install through [brew](https://brew.sh). _macOS only_.
- Download standalone binary. _Linux x86_64 and macOS arm64 only_.
## Manual

View file

@ -58,27 +58,37 @@ function install_with_brew() {
}
function download_binary() {
mkdir -p $CURRENT_DIR/bin
function asset_suffix() {
local arch=$(uname -m)
if [[ ! "$(uname -m)" == "x86_64" ]]; then
echo "tmux-fingers binaries are only provided for x86_64 architecture."
if [[ "$PLATFORM" == "Linux" && "$arch" == "x86_64" ]]; then
echo "linux-x86_64"
elif [[ "$PLATFORM" == "Darwin" && "$arch" == "arm64" ]]; then
echo "macos-arm64"
fi
}
function download_binary() {
local suffix=$(asset_suffix)
if [[ -z "$suffix" ]]; then
echo "No pre-built binary available for your platform ($(uname -s) $(uname -m))."
exit 1
fi
mkdir -p $CURRENT_DIR/bin
echo "Getting latest release..."
# TODO use "latest" tag
url=$(curl -s "https://api.github.com/repos/morantron/tmux-fingers/releases" | grep browser_download_url | head -1 | grep -o https://.*x86_64)
echo "Downloading binary from $url"
url=$(curl -s "https://api.github.com/repos/Morantron/tmux-fingers/releases" | grep -o "https://.*${suffix}" | head -1)
if [[ -z "$url" ]]; then
echo "Could not find a release for tmux-fingers. Please try again later."
exit 1
fi
# download binary to bin/tmux-fingers
echo "Downloading binary from $url"
curl -L $url -o $CURRENT_DIR/bin/tmux-fingers
chmod a+x $CURRENT_DIR/bin/tmux-fingers
@ -100,40 +110,37 @@ if [[ "$1" == "install-from-source" ]]; then
install_from_source
fi
function binary_or_brew_label() {
if [[ "$PLATFORM" == "Darwin" ]]; then
echo "Install with brew"
else
echo "Download binary"
fi
}
function binary_or_brew_action() {
if [[ "$PLATFORM" == "Darwin" ]]; then
echo "install-with-brew"
else
echo "download-binary"
fi
}
function get_message() {
if [[ "$FINGERS_UPDATE" == "1" ]]; then
echo "It looks like tmux-fingers has been updated. We need to rebuild the binary."
else
echo "It looks like it is the first time you are running the plugin. We first need to get tmux-fingers binary for things to work."
fi
}
tmux display-menu -T "tmux-fingers" \
"" \
"- " "" ""\
"- #[nodim,bold]Welcome to tmux-fingers! ✌️ " "" ""\
"- " "" ""\
"- $(get_message) " "" "" \
"- " "" ""\
"" \
"$(binary_or_brew_label)" b "new-window \"$CURRENT_DIR/install-wizard.sh $(binary_or_brew_action)\"" \
"Build from source (crystal required)" s "new-window \"$CURRENT_DIR/install-wizard.sh install-from-source\"" \
"" \
menu_args=(
-T "tmux-fingers"
""
"- " "" ""
"- #[nodim,bold]Welcome to tmux-fingers! ✌️ " "" ""
"- " "" ""
"- $(get_message) " "" ""
"- " "" ""
""
)
if [[ -n "$(asset_suffix)" ]]; then
menu_args+=("Download binary" b "new-window \"$CURRENT_DIR/install-wizard.sh download-binary\"")
fi
if [[ "$PLATFORM" == "Darwin" ]]; then
menu_args+=("Install with brew" w "new-window \"$CURRENT_DIR/install-wizard.sh install-with-brew\"")
fi
menu_args+=(
"Build from source (crystal required)" s "new-window \"$CURRENT_DIR/install-wizard.sh install-from-source\""
""
"Exit" q ""
)
tmux display-menu "${menu_args[@]}"