Skip to content

Platform Detection

pubm ships a built-in platform detection engine that parses OS, architecture, ABI, and variant from file paths. It feeds automatic asset naming, OS-aware compression defaults, and the structured ParsedPlatform object used by plugins such as @pubm/plugin-brew.

When you configure a releaseAssets entry, pubm inspects each matched file path to determine its platform.

Two modes are available:

Use capture variables in the path pattern. If the pattern contains {os}, {arch}, {abi}, {variant}, or {platform}, pubm extracts values from those positions directly:

// Rust-style triple: captures arch, vendor, os, abi from the path
{ path: "target/{arch}-{vendor}-{os}-{abi}/release/mytool" }
// Bun-style: captures the entire platform segment
{ path: "platforms/{platform}/bin/mytool" }

Use automatic segment scanning. When no capture variables are used, pubm splits the path into segments on /, then splits each segment on -. Each token is tested against the OS, arch, ABI, variant, and vendor tables in order. The first match per category wins.

// Path: platforms/darwin-arm64/bin/pubm
// Segment: darwin-arm64 → tokens: [darwin, arm64]
// darwin → os: "darwin", arm64 → arch: "arm64"
{ path: "platforms/*/bin/pubm" }

Tokens that do not match any table are ignored.

The {platform} template variable holds the raw platform string:

  • If {platform} was a capture variable: the captured segment verbatim (darwin-arm64)
  • If individual capture variables were used ({os}, {arch}): assembled as {os}-{arch}
  • If automatic detection was used: the matched path segment (darwin-arm64)

Vendor, ABI, and variant are intentionally excluded from {platform} to keep the common case short. They are accessible individually via {vendor}, {abi}, and {variant}.

interface ParsedPlatform {
/** Captured raw string or matched segment */
raw: string;
os?: string;
arch?: string;
vendor?: string;
abi?: string;
variant?: string;
}

This object is attached to every asset that flows through the pipeline and is exposed to plugins via ReleaseAsset.platform in the afterRelease hook.

Canonical values are used in template variables and plugin comparisons. Aliases are recognized during path parsing.

CanonicalAliases
darwinmacos, mac, osx, macosx
linuxlin
windowswin, win32, win64
freebsd
openbsd
netbsd
android
ios
solarissunos
illumos
aix
dragonflydragonflybsd
plan9
fuchsia
haiku
redox
CanonicalAliases
x64x86_64, amd64, x86-64
ia32i386, i486, i586, i686, x86, 386
arm64aarch64, armv8, aarch_64
armarmv7, armv7l, armv6, armv6l, armhf, armel
ppc64lepowerpc64le, ppc64el
ppc64powerpc64
ppcpowerpc
s390x
riscv64riscv64gc
loong64loongarch64, la64
mipsmips32
mipselmipsle
mips64
mips64elmips64le
wasm32wasm
wasm64
universaluniversal2, fat

ABI tokens appear in Rust target triples and cross-compilation toolchain names.

ValueMeaning
gnu / glibcGNU C Library
muslmusl libc (static-friendly)
msvcMicrosoft Visual C++ runtime
mingw / mingw32 / mingw-w64MinGW toolchain
gnueabihfARM hard-float with glibc
gnueabiARM soft-float with glibc
musleabihfARM hard-float with musl
musleabiARM soft-float with musl
androideabiAndroid ARM EABI
uclibcuClibc for embedded targets
bionicAndroid’s Bionic C library

Variant tokens express microarchitecture levels or capability requirements.

ValueMeaning
baselineNo AVX2; SSE4.2 only
v2x86-64 microarchitecture level 2
v3x86-64 microarchitecture level 3 (AVX2)
v4x86-64 microarchitecture level 4 (AVX-512)
avx2Explicit AVX2 requirement
avx512Explicit AVX-512 requirement

Vendor tokens are recognized during parsing but are not included in the {platform} variable. Access them through {vendor}.

ValueMeaning
unknownGeneric (Rust default for Linux targets)
appleApple platforms (macOS, iOS)
pcPC/desktop (Windows, Solaris)
noneBare-metal targets
platforms/darwin-arm64/bin/pubm
platforms/linux-x64/bin/pubm
platforms/windows-x64/bin/pubm.exe

Config:

releaseAssets: ["platforms/*/bin/pubm"]

Results:

Pathosarch{platform}
platforms/darwin-arm64/bin/pubmdarwinarm64darwin-arm64
platforms/linux-x64/bin/pubmlinuxx64linux-x64
platforms/windows-x64/bin/pubm.exewindowsx64windows-x64
target/x86_64-unknown-linux-gnu/release/mytool
target/aarch64-apple-darwin/release/mytool

Config:

releaseAssets: [
{ path: "target/{arch}-{vendor}-{os}-{abi}/release/mytool" },
{ path: "target/{arch}-{vendor}-{os}/release/mytool" },
]

Results:

Pathosarchvendorabi
x86_64-unknown-linux-gnulinuxx64unknowngnu
aarch64-apple-darwindarwinarm64apple-

All aliases resolve to the canonical form before template substitution:

bin/myapp-amd64-macos → os: "darwin", arch: "x64"
bin/myapp-win64 → os: "windows"
bin/myapp-armv7l → arch: "arm"