Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/quiet-plums-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"fnm": patch
---

Add Debian packages for amd64 and arm64

`.deb` packages are now built for amd64 and arm64, wrapping the same statically linked musl binary already shipped in the `fnm-linux` / `fnm-arm64` zip assets. They're a convenience download — install with `sudo dpkg -i fnm_<version>-1_<arch>.deb` — not a package submitted to Debian's official archive. Like every other release asset, they're produced as CI artifacts and attached to releases by hand.
58 changes: 58 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,64 @@ jobs:
name: fnm-${{ matrix.arch }}
path: target/${{ env.RUST_TARGET }}/release/fnm

build_deb:
name: "Build Debian packages"
runs-on: ubuntu-latest
needs: [build_static_linux_binary, build_static_arm_binary]
steps:
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{env.RUST_VERSION}}
- uses: Swatinem/rust-cache@v2
with:
key: deb-packages
- name: "Download `cargo-deb` crate"
run: cargo install cargo-deb@3.7.0 --locked
- uses: actions/download-artifact@v4
with:
name: fnm-linux
path: target/x86_64-unknown-linux-musl/release
- uses: actions/download-artifact@v4
with:
name: fnm-arm64
path: target/aarch64-unknown-linux-musl/release
- name: mark binaries as executable
run: |
chmod +x target/x86_64-unknown-linux-musl/release/fnm
chmod +x target/aarch64-unknown-linux-musl/release/fnm
- name: Build Debian packages
run: |
cargo deb --target x86_64-unknown-linux-musl --no-build --no-strip
cargo deb --target aarch64-unknown-linux-musl --no-build --no-strip
- name: Sanity test amd64 package
run: |
set -- target/debian/fnm_*_amd64.deb
test "$#" -eq 1
test -f "$1"
sudo dpkg -i "$1"
test "$(fnm --version)" = "fnm $(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')"
- name: Verify arm64 package
run: |
set -- target/debian/fnm_*_arm64.deb
test "$#" -eq 1
test -f "$1"
deb="$1"
test "$(dpkg-deb -f "$deb" Package)" = "fnm"
test "$(dpkg-deb -f "$deb" Architecture)" = "arm64"
dpkg-deb -c "$deb" | grep -q '^-rwxr-xr-x .*\./usr/bin/fnm$'
test "$(dpkg-deb -c "$deb" | grep -c './usr/bin/[^/]')" -eq 1
dpkg-deb --fsys-tarfile "$deb" | tar -xO ./usr/bin/fnm > /tmp/fnm-arm64
readelf -h /tmp/fnm-arm64 | grep -qi aarch64
- uses: actions/upload-artifact@v4
with:
name: fnm-deb-amd64
path: target/debian/fnm_*_amd64.deb
- uses: actions/upload-artifact@v4
with:
name: fnm-deb-arm64
path: target/debian/fnm_*_arm64.deb

ensure_commands_markdown_is_up_to_date:
runs-on: ubuntu-latest
name: Ensure command docs are up-to-date
Expand Down
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ license = "GPL-3.0"
repository = "https://github.com/Schniz/fnm"
description = "Fast and simple Node.js version manager"

[package.metadata.deb]
maintainer = "Gal Schlezinger <gal@spitfire.co.il>"
section = "utils"
depends = ""
license-file = ["LICENSE", "0"]
assets = [["target/release/fnm", "usr/bin/", "755"]]
extended-description = """\
fnm is a fast and simple Node.js version manager. It works with .node-version
and .nvmrc files, and is enabled in your shell by evaluating the output of
`fnm env`. See https://github.com/Schniz/fnm for shell setup instructions."""

[dependencies]
serde = { version = "1.0.203", features = ["derive"] }
clap = { version = "4.5.4", features = ["derive", "env"] }
Expand Down