chore: import upstream snapshot with attribution
Deploy to GitHub Pages / deploy (push) Failing after 0s
CI / go (push) Has been cancelled
CI / build (darwin, macos-14) (push) Has been cancelled
CI / build (windows, windows-2025) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:31:13 +08:00
commit ead81af521
414 changed files with 73946 additions and 0 deletions
+109
View File
@@ -0,0 +1,109 @@
name: Publish to AUR
on:
workflow_run:
workflows: ["Release"]
types: [completed]
jobs:
aur:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout
uses: actions/checkout@v7.0.0
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Extract version
id: version
run: |
TAG="${{ github.event.workflow_run.head_branch }}"
echo "pkgver=${TAG#v}" >> "$GITHUB_OUTPUT"
- name: Generate PKGBUILD
env:
PKGVER: ${{ steps.version.outputs.pkgver }}
REPO: ${{ github.repository }}
run: |
SOURCE_URL="https://github.com/${REPO}/archive/refs/tags/v${PKGVER}.tar.gz"
SHA256=$(curl -sL "$SOURCE_URL" | sha256sum | cut -d' ' -f1)
cat > PKGBUILD <<'HEREDOC'
# Maintainer: bjarneo <https://github.com/bjarneo>
pkgname=cliamp
pkgver=PKGVER_PLACEHOLDER
pkgrel=1
pkgdesc='A retro terminal music player inspired by Winamp 2.x'
arch=('x86_64' 'aarch64')
url='https://github.com/bjarneo/cliamp'
license=('MIT')
depends=('alsa-lib' 'flac' 'libvorbis' 'libogg' 'ffmpeg' 'yt-dlp')
optdepends=('pipewire-alsa: audio output on PipeWire systems'
'pulseaudio-alsa: audio output on PulseAudio systems')
makedepends=('go')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/bjarneo/cliamp/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('SHA256_PLACEHOLDER')
build() {
cd "${pkgname}-${pkgver}"
export CGO_ENABLED=1
go build -trimpath -buildmode=pie \
-ldflags="-s -w -X main.version=v${pkgver} -linkmode=external" \
-o cliamp .
}
package() {
cd "${pkgname}-${pkgver}"
install -Dm755 cliamp "${pkgdir}/usr/bin/cliamp"
install -Dm644 cliamp.desktop "${pkgdir}/usr/share/applications/cliamp.desktop"
install -Dm644 Cliamp.png "${pkgdir}/usr/share/icons/hicolor/512x512/apps/cliamp.png"
install -Dm644 Cliamp.png "${pkgdir}/usr/share/pixmaps/cliamp.png"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
HEREDOC
sed -i 's/^ //' PKGBUILD
sed -i "s|PKGVER_PLACEHOLDER|${PKGVER}|" PKGBUILD
sed -i "s|SHA256_PLACEHOLDER|${SHA256}|" PKGBUILD
cat PKGBUILD
- name: Publish to AUR
env:
AUR_SSH_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
AUR_USERNAME: ${{ secrets.AUR_USERNAME }}
AUR_EMAIL: ${{ secrets.AUR_EMAIL }}
PKGVER: ${{ steps.version.outputs.pkgver }}
run: |
# Setup SSH
mkdir -p ~/.ssh
echo "$AUR_SSH_KEY" > ~/.ssh/aur
chmod 600 ~/.ssh/aur
ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
cat >> ~/.ssh/config <<EOF
Host aur.archlinux.org
IdentityFile ~/.ssh/aur
User aur
EOF
# Clone AUR repo
git clone ssh://aur@aur.archlinux.org/cliamp.git aur-repo
cd aur-repo
git config user.name "$AUR_USERNAME"
git config user.email "$AUR_EMAIL"
# Copy PKGBUILD and generate .SRCINFO
cp ../PKGBUILD .
docker run --rm -v "$PWD/PKGBUILD:/PKGBUILD:ro" archlinux:base bash -c \
'pacman -Sy --noconfirm pacman-contrib >&2 && cp /PKGBUILD /tmp/ && cd /tmp && chown nobody PKGBUILD && runuser -u nobody -- makepkg --printsrcinfo' > .SRCINFO
# Commit and push
git add PKGBUILD .SRCINFO
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "Update to v${PKGVER}"
git push
fi
+44
View File
@@ -0,0 +1,44 @@
name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
go:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- run: sudo apt-get update && sudo apt-get install -y libasound2-dev shellcheck
- run: go install honnef.co/go/tools/cmd/staticcheck@v0.6.1
- run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.4
- run: make fmt-check vet staticcheck security
- run: go test -count=1 -race ./...
- run: make coverage
- run: shellcheck install.sh
- run: git diff --exit-code
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
goos: darwin
- os: windows-2025
goos: windows
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: go test -count=1 ./...
- run: go build -trimpath ./...
+31
View File
@@ -0,0 +1,31 @@
name: Deploy to GitHub Pages
on:
push:
branches: [main]
paths: [site/**]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v7.0.0
- uses: actions/configure-pages@v6.0.0
- uses: actions/upload-pages-artifact@v5.0.0
with:
path: site
- id: deployment
uses: actions/deploy-pages@v5.0.0
+352
View File
@@ -0,0 +1,352 @@
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- goos: linux
goarch: amd64
runner: ubuntu-latest
- goos: linux
goarch: arm64
runner: ubuntu-latest
- goos: darwin
goarch: amd64
runner: macos-latest
- goos: darwin
goarch: arm64
runner: macos-latest
- goos: windows
goarch: amd64
runner: windows-latest
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v7.0.0
- name: Set up Go
uses: actions/setup-go@v6.5.0
with:
go-version-file: go.mod
- name: Install deps (Linux amd64)
if: matrix.goos == 'linux' && matrix.goarch == 'amd64'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev libflac-dev libvorbis-dev libogg-dev
- name: Install deps (Linux arm64 cross)
if: matrix.goos == 'linux' && matrix.goarch == 'arm64'
run: |
sudo dpkg --add-architecture arm64
# Pin existing DEB822 sources to amd64 only (noble+ uses this format)
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
sudo sed -i '/^Types:/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources
fi
# Pin traditional sources.list entries to amd64 (if any)
sudo sed -i 's/^deb \(http\)/deb [arch=amd64] \1/' /etc/apt/sources.list || true
# Add arm64 sources via ports.ubuntu.com
CODENAME=$(lsb_release -cs)
sudo tee /etc/apt/sources.list.d/arm64-ports.list > /dev/null <<EOF
deb [arch=arm64] http://ports.ubuntu.com/ ${CODENAME} main restricted universe multiverse
deb [arch=arm64] http://ports.ubuntu.com/ ${CODENAME}-updates main restricted universe multiverse
deb [arch=arm64] http://ports.ubuntu.com/ ${CODENAME}-security main restricted universe multiverse
EOF
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu libasound2-dev:arm64 libflac-dev:arm64 libvorbis-dev:arm64 libogg-dev:arm64
- name: Install deps (macOS arm64)
if: matrix.goos == 'darwin' && matrix.goarch == 'arm64'
run: brew install flac libvorbis libogg pkg-config
- name: Install deps (macOS amd64 cross)
if: matrix.goos == 'darwin' && matrix.goarch == 'amd64'
run: |
# Install x86_64 Homebrew under /usr/local via Rosetta 2
NONINTERACTIVE=1 arch -x86_64 /bin/bash -c \
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install flac libvorbis libogg pkg-config
- name: Force static linking of codec libs (Linux)
if: matrix.goos == 'linux'
env:
GOARCH: ${{ matrix.goarch }}
run: |
# Remove .so symlinks so the linker falls back to static .a archives.
# This avoids soname mismatches (e.g. libFLAC.so.12 vs .so.14) when
# the pre-built binary runs on distros with newer codec libraries.
if [ "$GOARCH" = "arm64" ]; then
LIB_DIR=/usr/lib/aarch64-linux-gnu
else
LIB_DIR=/usr/lib/x86_64-linux-gnu
fi
sudo rm -f ${LIB_DIR}/libFLAC.so
sudo rm -f ${LIB_DIR}/libvorbis.so
sudo rm -f ${LIB_DIR}/libvorbisenc.so
sudo rm -f ${LIB_DIR}/libogg.so
- name: Build (Linux)
if: matrix.goos == 'linux'
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "1"
run: |
if [ "$GOARCH" = "arm64" ]; then
export CC=aarch64-linux-gnu-gcc
export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig
fi
BINARY="cliamp-${GOOS}-${GOARCH}"
VERSION="${GITHUB_REF#refs/tags/}"
go build -trimpath \
-ldflags="-s -w -X main.version=${VERSION} -extldflags '-lvorbisenc -lvorbis -lFLAC -logg -lm'" \
-o "$BINARY" .
- name: Build (Windows)
if: matrix.goos == 'windows'
env:
GOOS: windows
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
shell: bash
run: |
BINARY="cliamp-windows-${GOARCH}.exe"
VERSION="${GITHUB_REF#refs/tags/}"
go build -trimpath -ldflags="-s -w -X main.version=${VERSION}" -o "$BINARY" .
- name: Build (macOS)
if: matrix.goos == 'darwin'
env:
CGO_ENABLED: "1"
GOARCH: ${{ matrix.goarch }}
run: |
if [ "$GOARCH" = "amd64" ]; then
# Cross-compile for x86_64 using Rosetta 2 installed libs
export CC="clang -arch x86_64"
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
export CGO_CFLAGS="-I/usr/local/include"
export CGO_LDFLAGS="-L/usr/local/lib"
fi
BINARY="cliamp-darwin-${GOARCH}"
VERSION="${GITHUB_REF#refs/tags/}"
go build -trimpath -ldflags="-s -w -X main.version=${VERSION}" -o "$BINARY" .
- name: Upload artifact
uses: actions/upload-artifact@v7.0.1
with:
name: cliamp-${{ matrix.goos }}-${{ matrix.goarch }}
path: cliamp-*
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7.0.0
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v8.0.1
with:
path: artifacts
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum cliamp-* > checksums.txt
cat checksums.txt
- name: Generate changelog
env:
REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: |
TAG="${GITHUB_REF#refs/tags/}"
PREV_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || echo "")
CHANGELOG=""
if [ -z "$PREV_TAG" ]; then
RANGE="$TAG"
else
RANGE="${PREV_TAG}..${TAG}"
fi
while IFS='|' read -r hash title author || [ -n "$hash" ]; do
short_hash="${hash:0:7}"
username=$(gh api "repos/${REPO}/commits/$hash" --jq '.author.login' 2>/dev/null || echo "")
if [ -n "$username" ]; then
author_info="$author ([@$username](https://github.com/$username))"
else
author_info="$author"
fi
CHANGELOG="${CHANGELOG}- $title by $author_info ([\`$short_hash\`](https://github.com/${REPO}/commit/$hash))"$'\n'
done < <(git log "$RANGE" --pretty=format:"%H|%s|%an")
{
echo "## What's Changed"
echo ""
echo "$CHANGELOG"
echo ""
echo "## Checksums (SHA256)"
echo ""
echo '```'
cat artifacts/checksums.txt
echo '```'
echo ""
if [ -n "$PREV_TAG" ]; then
echo "**Full Changelog**: https://github.com/${REPO}/compare/${PREV_TAG}...${TAG}"
fi
} > release_notes.md
- name: Create release
uses: softprops/action-gh-release@v3.0.1
with:
body_path: release_notes.md
files: |
artifacts/cliamp-*
artifacts/checksums.txt
- name: Upload checksums artifact
uses: actions/upload-artifact@v7.0.1
with:
name: checksums
path: artifacts/checksums.txt
update-homebrew:
needs: release
runs-on: ubuntu-latest
steps:
- name: Download checksums
uses: actions/download-artifact@v8.0.1
with:
name: checksums
- name: Set env vars
env:
REPO: ${{ github.repository }}
run: |
TAG="${GITHUB_REF#refs/tags/}"
VERSION="${TAG#v}"
cat checksums.txt
curl -fsSL "https://raw.githubusercontent.com/${REPO}/${TAG}/Cliamp.png" -o Cliamp.png
curl -fsSL "https://raw.githubusercontent.com/${REPO}/${TAG}/cliamp.desktop" -o cliamp.desktop
SHA_ICON=$(sha256sum Cliamp.png | awk '{print $1}')
SHA_DESKTOP=$(sha256sum cliamp.desktop | awk '{print $1}')
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_ENV
echo "SHA_DARWIN_ARM64=$(grep 'darwin-arm64' checksums.txt | awk '{print $1}')" >> $GITHUB_ENV
echo "SHA_DARWIN_AMD64=$(grep 'darwin-amd64' checksums.txt | awk '{print $1}')" >> $GITHUB_ENV
echo "SHA_LINUX_ARM64=$(grep 'linux-arm64' checksums.txt | awk '{print $1}')" >> $GITHUB_ENV
echo "SHA_LINUX_AMD64=$(grep 'linux-amd64' checksums.txt | awk '{print $1}')" >> $GITHUB_ENV
echo "SHA_ICON=${SHA_ICON}" >> $GITHUB_ENV
echo "SHA_DESKTOP=${SHA_DESKTOP}" >> $GITHUB_ENV
- name: Generate and push formula
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
git clone "https://x-access-token:${GH_TOKEN}@github.com/bjarneo/homebrew-cliamp.git"
cd homebrew-cliamp
mkdir -p Formula
cat > Formula/cliamp.rb << 'FORMULA'
class Cliamp < Formula
desc "A retro terminal music player inspired by Winamp 2.x"
homepage "https://github.com/bjarneo/cliamp"
head "https://github.com/bjarneo/cliamp.git", branch: "main"
depends_on "flac"
depends_on "libvorbis"
depends_on "libogg"
depends_on "ffmpeg" => :recommended
depends_on "yt-dlp" => :recommended
depends_on "go" => :build
FORMULA
cat >> Formula/cliamp.rb << EOF
version "${VERSION}"
on_macos do
on_arm do
url "https://github.com/bjarneo/cliamp/releases/download/${TAG}/cliamp-darwin-arm64"
sha256 "${SHA_DARWIN_ARM64}"
end
on_intel do
url "https://github.com/bjarneo/cliamp/releases/download/${TAG}/cliamp-darwin-amd64"
sha256 "${SHA_DARWIN_AMD64}"
end
end
on_linux do
on_arm do
url "https://github.com/bjarneo/cliamp/releases/download/${TAG}/cliamp-linux-arm64"
sha256 "${SHA_LINUX_ARM64}"
end
on_intel do
url "https://github.com/bjarneo/cliamp/releases/download/${TAG}/cliamp-linux-amd64"
sha256 "${SHA_LINUX_AMD64}"
end
end
resource "icon" do
url "https://raw.githubusercontent.com/bjarneo/cliamp/${TAG}/Cliamp.png"
sha256 "${SHA_ICON}"
end
resource "desktop" do
url "https://raw.githubusercontent.com/bjarneo/cliamp/${TAG}/cliamp.desktop"
sha256 "${SHA_DESKTOP}"
end
def install
if build.head?
# Build from source for HEAD
system "go", "build", "-ldflags", "-s -w", "-o", bin/"cliamp", "."
else
# Use pre-built binary for stable releases
binary = Dir["cliamp-*"].first
bin.install binary => "cliamp"
end
# Ship icon under pkgshare so it's always available; expose as
# XDG icon + desktop entry on Linux for app-launcher integration.
resource("icon").stage { pkgshare.install "Cliamp.png" => "cliamp.png" }
on_linux do
(share/"icons/hicolor/512x512/apps").install_symlink pkgshare/"cliamp.png"
(share/"pixmaps").install_symlink pkgshare/"cliamp.png"
resource("desktop").stage { (share/"applications").install "cliamp.desktop" }
end
end
test do
assert_match version.to_s, shell_output("#{bin}/cliamp --version")
end
end
EOF
sed -i 's/^ //' Formula/cliamp.rb
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/cliamp.rb
git commit -m "Update cliamp to ${VERSION}"
git push