197 lines
5.9 KiB
YAML
197 lines
5.9 KiB
YAML
# ABOUTME: Release workflow triggered by version tags
|
|
# ABOUTME: Builds player + server for Linux/macOS/Windows and creates GitHub release
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
# Drop the libopusfile parts of gopkg.in/hraban/opus.v2 so the released
|
|
# binary doesn't link libopusfile.so.0 / opusfile.dylib at runtime. We
|
|
# never call the opus.Stream API. See ci.yml for the same setup.
|
|
env:
|
|
GOFLAGS: -tags=nolibopusfile
|
|
|
|
jobs:
|
|
test:
|
|
name: Test Before Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libopus-dev libasound2-dev
|
|
|
|
- name: Run tests
|
|
run: go test -v -race ./...
|
|
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: latest
|
|
args: --timeout=5m
|
|
|
|
build:
|
|
name: Build ${{ matrix.os }}/${{ matrix.arch }}
|
|
needs: test
|
|
runs-on: ${{ matrix.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: linux
|
|
arch: amd64
|
|
runner: ubuntu-latest
|
|
ext: ""
|
|
- os: linux
|
|
arch: arm64
|
|
runner: ubuntu-24.04-arm
|
|
ext: ""
|
|
- os: darwin
|
|
arch: arm64
|
|
runner: macos-latest
|
|
ext: ""
|
|
- os: windows
|
|
arch: amd64
|
|
runner: windows-latest
|
|
ext: ".exe"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: Install dependencies (Linux)
|
|
if: matrix.os == 'linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libopus-dev libasound2-dev
|
|
|
|
- name: Install dependencies (macOS)
|
|
if: matrix.os == 'darwin'
|
|
run: brew install opus
|
|
|
|
- name: Install dependencies (Windows)
|
|
if: matrix.os == 'windows'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: MINGW64
|
|
update: false
|
|
install: >-
|
|
mingw-w64-x86_64-gcc
|
|
mingw-w64-x86_64-pkg-config
|
|
mingw-w64-x86_64-opus
|
|
|
|
- name: Get version
|
|
id: version
|
|
shell: bash
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build (Unix)
|
|
if: matrix.os != 'windows'
|
|
env:
|
|
CGO_ENABLED: "1"
|
|
run: |
|
|
LDFLAGS="-X github.com/Sendspin/sendspin-go/internal/version.Version=${{ steps.version.outputs.VERSION }} -s -w"
|
|
go build -ldflags "${LDFLAGS}" -o sendspin-player-${{ matrix.os }}-${{ matrix.arch }} .
|
|
go build -ldflags "${LDFLAGS}" -o sendspin-server-${{ matrix.os }}-${{ matrix.arch }} ./cmd/sendspin-server
|
|
|
|
- name: Build (Windows)
|
|
if: matrix.os == 'windows'
|
|
shell: cmd
|
|
run: |
|
|
set PATH=D:\a\_temp\msys64\mingw64\bin;%PATH%
|
|
set CGO_ENABLED=1
|
|
set CC=gcc
|
|
set LDFLAGS=-X github.com/Sendspin/sendspin-go/internal/version.Version=${{ steps.version.outputs.VERSION }} -s -w
|
|
go build -ldflags "%LDFLAGS%" -o sendspin-player-windows-amd64.exe .
|
|
go build -ldflags "%LDFLAGS%" -o sendspin-server-windows-amd64.exe .\cmd\sendspin-server
|
|
|
|
- name: Create archives (Unix)
|
|
if: matrix.os != 'windows'
|
|
run: |
|
|
tar czf sendspin-player-${{ matrix.os }}-${{ matrix.arch }}.tar.gz sendspin-player-${{ matrix.os }}-${{ matrix.arch }}
|
|
tar czf sendspin-server-${{ matrix.os }}-${{ matrix.arch }}.tar.gz sendspin-server-${{ matrix.os }}-${{ matrix.arch }}
|
|
|
|
- name: Create archives (Windows)
|
|
if: matrix.os == 'windows'
|
|
shell: bash
|
|
run: |
|
|
7z a sendspin-player-windows-amd64.zip sendspin-player-windows-amd64.exe
|
|
7z a sendspin-server-windows-amd64.zip sendspin-server-windows-amd64.exe
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-${{ matrix.os }}-${{ matrix.arch }}
|
|
path: |
|
|
sendspin-player-${{ matrix.os }}-${{ matrix.arch }}.*
|
|
sendspin-server-${{ matrix.os }}-${{ matrix.arch }}.*
|
|
|
|
release:
|
|
name: Create Release
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get version
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
pattern: release-*
|
|
merge-multiple: true
|
|
|
|
- name: List artifacts
|
|
run: ls -lh artifacts/
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.version.outputs.VERSION }}
|
|
name: ${{ steps.version.outputs.VERSION }}
|
|
body: |
|
|
## Sendspin ${{ steps.version.outputs.VERSION }}
|
|
|
|
### Downloads
|
|
|
|
| Platform | Player | Server |
|
|
|----------|--------|--------|
|
|
| Linux x86_64 | `sendspin-player-linux-amd64.tar.gz` | `sendspin-server-linux-amd64.tar.gz` |
|
|
| Linux ARM64 | `sendspin-player-linux-arm64.tar.gz` | `sendspin-server-linux-arm64.tar.gz` |
|
|
| macOS Apple Silicon | `sendspin-player-darwin-arm64.tar.gz` | `sendspin-server-darwin-arm64.tar.gz` |
|
|
| Windows x86_64 | `sendspin-player-windows-amd64.zip` | `sendspin-server-windows-amd64.zip` |
|
|
|
|
### Daemon mode (Linux)
|
|
|
|
```bash
|
|
tar xzf sendspin-player-linux-amd64.tar.gz
|
|
sudo install -m 755 sendspin-player-linux-amd64 /usr/local/bin/sendspin-player
|
|
# Copy the systemd unit from dist/systemd/ in the source repo, then:
|
|
sudo systemctl enable --now sendspin-player
|
|
```
|
|
files: artifacts/*
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|