Skip to content

Commit ed55394

Browse files
committed
chore(release): switch to local release flow with Homebrew tap
Releases are now cut locally with `goreleaser release --clean` rather than from a CI workflow, mirroring the iRootPro/rdr setup. Goreleaser uploads binaries to GitHub Releases and pushes the formula to iRootPro/homebrew-tap in one shot, using the local gh-cli token — no PAT secret needed in the repo. - .github/workflows/release.yml: removed (CI now only runs vet/test/build). - .goreleaser.yaml: brews block targeting iRootPro/homebrew-tap with mpv + optional yt-dlp dependencies and a --version smoke test. - scripts/install.sh: POSIX shell installer that auto-detects OS/arch, resolves the latest release tag (or honors VERSION=...), downloads the matching tarball, and drops the binary into ~/.local/bin (override with INSTALL_DIR=...). Hints when mpv is missing. - README.md / README.ru.md: install section adds Homebrew tap and one-line installer paths; release notes describe the local flow.
1 parent 9764af8 commit ed55394

5 files changed

Lines changed: 155 additions & 36 deletions

File tree

.github/workflows/release.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.goreleaser.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,24 @@ release:
5252
draft: false
5353
prerelease: auto
5454
name_template: "v{{ .Version }}"
55+
56+
brews:
57+
- name: lofi-player
58+
homepage: https://github.com/iRootPro/lofi-player
59+
description: Keyboard-driven TUI for lofi, chillhop and ambient internet radio
60+
license: MIT
61+
repository:
62+
owner: iRootPro
63+
name: homebrew-tap
64+
commit_author:
65+
name: goreleaserbot
66+
email: bot@goreleaser.com
67+
commit_msg_template: "brew: lofi-player {{ .Tag }}"
68+
dependencies:
69+
- name: mpv
70+
- name: yt-dlp
71+
type: optional
72+
install: |
73+
bin.install "lofi-player"
74+
test: |
75+
system "#{bin}/lofi-player", "--version"

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ direct HTTP streams, and YouTube live/videos via `yt-dlp`).
5555

5656
## Install
5757

58+
### Homebrew (macOS, Linux)
59+
60+
```sh
61+
brew install iRootPro/tap/lofi-player
62+
```
63+
64+
### One-line installer (macOS, Linux)
65+
66+
```sh
67+
curl -fsSL https://raw.githubusercontent.com/iRootPro/lofi-player/main/scripts/install.sh | sh
68+
```
69+
70+
Drops the binary into `~/.local/bin` by default. Override with
71+
`INSTALL_DIR=/usr/local/bin` or pin to a specific tag with
72+
`VERSION=v0.1.0`.
73+
5874
### From source (Go 1.26+)
5975

6076
```sh
@@ -250,9 +266,11 @@ go test ./...
250266
go vet ./...
251267
```
252268

253-
The Makefile-free workflow on purpose. Releases are produced by
254-
`goreleaser` from `.goreleaser.yaml`; the GitHub Actions workflow
255-
in `.github/workflows/release.yml` runs it on every `v*` tag.
269+
The Makefile-free workflow on purpose. Releases are cut locally:
270+
`git tag -a vX.Y.Z -m "..."` then `goreleaser release --clean`
271+
goreleaser uploads the binaries to GitHub Releases and pushes the
272+
updated formula to [iRootPro/homebrew-tap](https://github.com/iRootPro/homebrew-tap)
273+
in one shot. CI on `main` runs `vet` + `test` + `build` on every push.
256274

257275
## Credits
258276

README.ru.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ TUI-плеер для лофи, чиллхопа и эмбиент-радио
5959

6060
## Установка
6161

62+
### Homebrew (macOS, Linux)
63+
64+
```sh
65+
brew install iRootPro/tap/lofi-player
66+
```
67+
68+
### Однострочный инсталлер (macOS, Linux)
69+
70+
```sh
71+
curl -fsSL https://raw.githubusercontent.com/iRootPro/lofi-player/main/scripts/install.sh | sh
72+
```
73+
74+
По умолчанию кладёт бинарник в `~/.local/bin`. Можно переопределить
75+
через `INSTALL_DIR=/usr/local/bin` или заПинить версию через
76+
`VERSION=v0.1.0`.
77+
6278
### Из исходников (Go 1.26+)
6379

6480
```sh
@@ -255,9 +271,11 @@ go test ./...
255271
go vet ./...
256272
```
257273

258-
Workflow без Makefile — это сознательно. Релизы собирает
259-
`goreleaser` из `.goreleaser.yaml`; GitHub Actions workflow в
260-
`.github/workflows/release.yml` запускает его на каждом теге `v*`.
274+
Workflow без Makefile — это сознательно. Релизы делаются локально:
275+
`git tag -a vX.Y.Z -m "..."` потом `goreleaser release --clean`
276+
goreleaser сразу загружает бинарники в GitHub Releases и пушит
277+
обновлённую формулу в [iRootPro/homebrew-tap](https://github.com/iRootPro/homebrew-tap).
278+
CI на `main` гоняет `vet` + `test` + `build` на каждый push.
261279

262280
## Кредиты
263281

scripts/install.sh

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/sh
2+
# install.sh — one-line installer for lofi-player on macOS and Linux.
3+
#
4+
# Usage:
5+
# curl -fsSL https://raw.githubusercontent.com/iRootPro/lofi-player/main/scripts/install.sh | sh
6+
#
7+
# Environment variables:
8+
# VERSION Pin to a specific tag (default: latest release).
9+
# INSTALL_DIR Where to put the binary (default: $HOME/.local/bin).
10+
#
11+
# Examples:
12+
# VERSION=v0.1.0 sh -c "$(curl -fsSL https://...install.sh)"
13+
# INSTALL_DIR=/usr/local/bin sh -c "$(curl -fsSL https://...install.sh)"
14+
15+
set -eu
16+
17+
REPO="iRootPro/lofi-player"
18+
19+
err() {
20+
printf '%s\n' "lofi-player install: $*" >&2
21+
exit 1
22+
}
23+
24+
# OS detection.
25+
case "$(uname -s)" in
26+
Darwin) os=darwin ;;
27+
Linux) os=linux ;;
28+
*) err "unsupported OS: $(uname -s) (only macOS and Linux are supported)" ;;
29+
esac
30+
31+
# Architecture detection. uname -m varies by OS, normalize to goreleaser names.
32+
case "$(uname -m)" in
33+
x86_64|amd64) arch=amd64 ;;
34+
arm64|aarch64) arch=arm64 ;;
35+
*) err "unsupported arch: $(uname -m) (only amd64 and arm64 are supported)" ;;
36+
esac
37+
38+
# Version resolution. Without an explicit VERSION, query the GitHub API for
39+
# the latest release tag. Without curl we have no way forward — we won't
40+
# wget/fetch since adding fallbacks tends to silently mask the real cause.
41+
command -v curl >/dev/null 2>&1 || err "curl is required and not on \$PATH"
42+
command -v tar >/dev/null 2>&1 || err "tar is required and not on \$PATH"
43+
44+
VERSION="${VERSION:-}"
45+
if [ -z "$VERSION" ]; then
46+
VERSION=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" \
47+
| sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p' \
48+
| head -n1)
49+
if [ -z "$VERSION" ]; then
50+
err "could not resolve the latest release; set VERSION=vX.Y.Z to override"
51+
fi
52+
fi
53+
54+
# Goreleaser strips the leading "v" from archive names.
55+
VERSION_NUMERIC="${VERSION#v}"
56+
57+
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
58+
59+
archive="lofi-player_${VERSION_NUMERIC}_${os}_${arch}.tar.gz"
60+
url="https://github.com/$REPO/releases/download/$VERSION/$archive"
61+
62+
# Stage download in a tempdir so a failed install doesn't leave half-extracted
63+
# files in the user's $PATH.
64+
tmp=$(mktemp -d 2>/dev/null || mktemp -d -t lofi-player)
65+
trap 'rm -rf "$tmp"' EXIT
66+
67+
printf 'lofi-player install: downloading %s\n' "$url"
68+
if ! curl -fSL --progress-bar "$url" -o "$tmp/$archive"; then
69+
err "download failed (HTTP error from $url)"
70+
fi
71+
72+
tar -C "$tmp" -xzf "$tmp/$archive"
73+
if [ ! -f "$tmp/lofi-player" ]; then
74+
err "archive did not contain a lofi-player binary"
75+
fi
76+
77+
mkdir -p "$INSTALL_DIR"
78+
mv "$tmp/lofi-player" "$INSTALL_DIR/lofi-player"
79+
chmod +x "$INSTALL_DIR/lofi-player"
80+
81+
printf 'lofi-player install: installed %s -> %s/lofi-player\n' "$VERSION" "$INSTALL_DIR"
82+
83+
case ":$PATH:" in
84+
*":$INSTALL_DIR:"*) ;;
85+
*) printf 'lofi-player install: NOTE: %s is not on $PATH\n' "$INSTALL_DIR" ;;
86+
esac
87+
88+
# Surface dependency hints — install is fine on its own, but the app refuses
89+
# to start without mpv. Cheap probe, no install attempted.
90+
if ! command -v mpv >/dev/null 2>&1; then
91+
printf 'lofi-player install: mpv is not installed; install with `brew install mpv` (macOS) or `apt install mpv` / `pacman -S mpv` (Linux)\n'
92+
fi

0 commit comments

Comments
 (0)