Skip to content

Fix aur

Fix aur #53

Workflow file for this run

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
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
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: 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}" -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@v4
with:
name: cliamp-${{ matrix.goos }}-${{ matrix.goarch }}
path: cliamp-*
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
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 }}
run: |
TAG="${GITHUB_REF#refs/tags/}"
PREV_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || echo "")
if [ -z "$PREV_TAG" ]; then
COMMITS=$(git log --pretty=format:"- %s (%h)" "$TAG")
else
COMMITS=$(git log --pretty=format:"- %s (%h)" "${PREV_TAG}..${TAG}")
fi
{
echo "## What's Changed"
echo ""
echo "$COMMITS"
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@v2
with:
body_path: release_notes.md
files: |
artifacts/cliamp-*
artifacts/checksums.txt
# Homebrew tap update is only relevant for the upstream repo (bjarneo/cliamp).
# Fork releases are available via `go install` or direct binary download.