Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto

go.sum -diff
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches: [master, main]
pull_request:
branches: [master, main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install ALSA dev libraries
run: sudo apt-get update && sudo apt-get install -y libasound2-dev

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install ALSA dev libraries
run: sudo apt-get update && sudo apt-get install -y libasound2-dev

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest

goreleaser-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"

- name: Check GoReleaser config
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: check
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Build ###
/somafm
/somafm-*
/out/
/dist/

### Go ###
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out
go.work
go.work.sum
vendor/

### Secrets ###
.env
.idea/
137 changes: 137 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

project_name: somafm

before:
hooks:
- go mod tidy

builds:
- id: somafm
main: ./cmd/somafm
binary: somafm
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X github.com/glebovdev/somafm-cli/internal/config.AppVersion={{.Version}}
ignore:
- goos: windows
goarch: arm64
# Linux requires CGO for audio (oto/v3)
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64

archives:
- id: default
formats:
- tar.gz
format_overrides:
- goos: windows
formats:
- zip
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- .Os }}_
{{- .Arch }}
files:
- README.md
- LICENSE

checksum:
name_template: "checksums.txt"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^chore:"
- "Merge pull request"
- "Merge branch"

release:
github:
owner: glebovdev
name: somafm-cli
draft: false
prerelease: auto
name_template: "v{{.Version}}"
header: |
## SomaFM CLI v{{.Version}}

A terminal-based music player for SomaFM radio stations.
footer: |
---
{{- if .PreviousTag }}

**Full Changelog**: https://github.com/glebovdev/somafm-cli/compare/{{ .PreviousTag }}...{{ .Tag }}
{{- end }}

## Installation

### macOS
```bash
brew install glebovdev/tap/somafm
```

### Windows
```powershell
scoop bucket add glebovdev https://github.com/glebovdev/scoop-bucket
scoop install somafm
```

### Linux
```bash
go install github.com/glebovdev/somafm-cli/cmd/somafm@latest
```
Pre-built binaries require CGO. Use `go install` which builds with your system's audio libraries.

# Homebrew cask configuration (replaces deprecated brews)
scoops:
- name: somafm
repository:
owner: glebovdev
name: scoop-bucket
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
homepage: "https://github.com/glebovdev/somafm-cli"
description: "Terminal-based music player for SomaFM radio stations"
license: MIT

homebrew_casks:
- name: somafm
repository:
owner: glebovdev
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
directory: Casks
url:
verified: github.com/glebovdev/somafm-cli
homepage: "https://github.com/glebovdev/somafm-cli"
description: "Terminal-based music player for SomaFM radio stations"
license: "MIT"
commit_author:
name: goreleaserbot
email: bot@goreleaser.com
binaries:
- somafm
hooks:
post:
install: |
if OS.mac?
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/somafm"]
end
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Ilya Glebov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
BINARY_NAME=somafm
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null | sed 's/^v//' || echo "dev")
LDFLAGS=-ldflags "-X github.com/glebovdev/somafm-cli/internal/config.AppVersion=$(VERSION)"

build:
go build $(LDFLAGS) -o $(BINARY_NAME) cmd/somafm/main.go

# Linux cross-compilation requires CGO for ALSA audio. Use GitHub Actions for Linux builds.
build-all:
GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o $(BINARY_NAME)-darwin-amd64 cmd/somafm/main.go
GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o $(BINARY_NAME)-darwin-arm64 cmd/somafm/main.go
GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o $(BINARY_NAME)-windows-amd64.exe cmd/somafm/main.go

test:
go test ./...

clean:
go clean
rm -f $(BINARY_NAME) $(BINARY_NAME)-*

.PHONY: build build-all test clean
Loading