mirror of
https://github.com/gogrlx/snack.git
synced 2026-04-01 20:58:42 -07:00
build(release): add Homebrew tap, install script, fix deprecations
- Replace deprecated brews with homebrew_casks - Replace deprecated nfpms.builds with nfpms.ids - Remove deprecated snapshot.name_template - Create gogrlx/homebrew-tap repo for Homebrew distribution - Add install.sh for curl-pipe-sh installation - Users can now: brew install gogrlx/tap/snack
This commit is contained in:
@@ -7,9 +7,6 @@ before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ incpatch .Version }}-next"
|
||||
|
||||
builds:
|
||||
- main: ./cmd/snack/
|
||||
id: snack
|
||||
@@ -44,7 +41,7 @@ archives:
|
||||
nfpms:
|
||||
- id: snack
|
||||
package_name: snack
|
||||
builds: [snack]
|
||||
ids: [snack]
|
||||
formats: [apk, deb, rpm]
|
||||
bindir: /usr/bin
|
||||
description: "A unified CLI for system package managers"
|
||||
@@ -53,6 +50,19 @@ nfpms:
|
||||
homepage: https://github.com/gogrlx/snack
|
||||
vendor: Adatomic, Inc.
|
||||
|
||||
homebrew_casks:
|
||||
- ids: [snack, snack-universal]
|
||||
name: snack
|
||||
binaries:
|
||||
- snack
|
||||
repository:
|
||||
owner: gogrlx
|
||||
name: homebrew-tap
|
||||
directory: Casks
|
||||
homepage: https://github.com/gogrlx/snack
|
||||
description: "A unified CLI for system package managers"
|
||||
license: 0BSD
|
||||
|
||||
release:
|
||||
github:
|
||||
owner: gogrlx
|
||||
|
||||
53
install.sh
Executable file
53
install.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
# Install snack - a unified CLI for system package managers
|
||||
# Usage: curl -sSfL https://raw.githubusercontent.com/gogrlx/snack/main/install.sh | sh
|
||||
set -e
|
||||
|
||||
REPO="gogrlx/snack"
|
||||
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
|
||||
|
||||
# Detect OS and arch
|
||||
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||
ARCH="$(uname -m)"
|
||||
case "$ARCH" in
|
||||
x86_64) ARCH="amd64" ;;
|
||||
aarch64) ARCH="arm64" ;;
|
||||
armv*) ARCH="arm" ;;
|
||||
esac
|
||||
|
||||
# macOS universal binary
|
||||
if [ "$OS" = "darwin" ]; then
|
||||
ARCH="universal"
|
||||
fi
|
||||
|
||||
echo "Detected: ${OS}/${ARCH}"
|
||||
|
||||
# Get latest release tag
|
||||
TAG="$(curl -sSf "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')"
|
||||
VERSION="${TAG#v}"
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Error: could not determine latest version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Installing snack ${VERSION}..."
|
||||
|
||||
TARBALL="snack-${VERSION}-${OS}-${ARCH}.tar.gz"
|
||||
URL="https://github.com/${REPO}/releases/download/${TAG}/${TARBALL}"
|
||||
|
||||
TMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
|
||||
curl -sSfL "$URL" -o "${TMP}/${TARBALL}"
|
||||
tar xzf "${TMP}/${TARBALL}" -C "$TMP"
|
||||
|
||||
if [ -w "$INSTALL_DIR" ]; then
|
||||
mv "${TMP}/snack" "${INSTALL_DIR}/snack"
|
||||
else
|
||||
echo "Installing to ${INSTALL_DIR} (requires sudo)..."
|
||||
sudo mv "${TMP}/snack" "${INSTALL_DIR}/snack"
|
||||
fi
|
||||
|
||||
chmod +x "${INSTALL_DIR}/snack"
|
||||
echo "snack ${VERSION} installed to ${INSTALL_DIR}/snack"
|
||||
Reference in New Issue
Block a user