From 324b483aa38eaf1752d015c1eb97ee0168e22824 Mon Sep 17 00:00:00 2001 From: Ilya Glebov Date: Wed, 28 Jan 2026 22:35:22 +0100 Subject: [PATCH] Add Linux support with prebuilt binaries Enable CGO for Linux builds (required for ALSA audio) while keeping CGO disabled for macOS/Windows cross-compilation. Install ALSA dev libraries in release workflow. --- .github/workflows/release.yml | 3 +++ .goreleaser.yaml | 22 +++++++++++++++------- README.md | 9 +++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 749e847..5b645ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,9 @@ jobs: with: go-version: "1.24" + - name: Install Linux audio dependencies + run: sudo apt-get update && sudo apt-get install -y libasound2-dev + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c415bba..5f3e9ec 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -10,13 +10,26 @@ before: - go mod tidy builds: - - id: somafm + - id: linux main: ./cmd/somafm binary: somafm env: - - CGO_ENABLED=0 + - CGO_ENABLED=1 goos: - linux + goarch: + - amd64 + - arm64 + ldflags: + - -s -w + - -X github.com/glebovdev/somafm-cli/internal/config.AppVersion={{.Version}} + + - id: darwin-windows + main: ./cmd/somafm + binary: somafm + env: + - CGO_ENABLED=0 + goos: - darwin - windows goarch: @@ -28,11 +41,6 @@ builds: ignore: - goos: windows goarch: arm64 - # Linux requires CGO for audio (oto/v3) - - goos: linux - goarch: amd64 - - goos: linux - goarch: arm64 archives: - id: default diff --git a/README.md b/README.md index 94c8437..48145e6 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,15 @@ A terminal-based music player for [SomaFM](https://somafm.com/) radio stations b brew install glebovdev/tap/somafm ``` +### Linux + +Download `somafm_*_linux_amd64.tar.gz` from the [Releases page](https://github.com/glebovdev/somafm-cli/releases) and extract: + +```bash +tar -xzf somafm_*_linux_amd64.tar.gz +sudo mv somafm /usr/local/bin/ +``` + ### Windows ```powershell