Set default value for audio device #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: [ 'v*' ] | |
permissions: | |
contents: write | |
jobs: | |
build-deps: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
target: [ 'arm-rpi-linux-gnueabihf', 'arm-linux-gnueabihf', 'aarch64-linux-gnu' ] | |
env: | |
CC: ${{ matrix.target }}-gcc | |
steps: | |
- name: Install toolchain for ${{ matrix.target }} | |
if: ${{ matrix.target != 'arm-rpi-linux-gnueabihf' }} | |
run: sudo apt-get update && sudo apt-get install -y gcc-${{ matrix.target }} | |
- name: Install custom toolchain for ${{ matrix.target }} | |
if: ${{ matrix.target == 'arm-rpi-linux-gnueabihf' }} | |
run: | | |
wget https://github.com/devgianlu/rpi-toolchain/releases/download/v1/arm-rpi-linux-gnueabihf.tar.gz | |
sudo tar -C /usr --strip-components=1 -xzf arm-rpi-linux-gnueabihf.tar.gz | |
- name: Download alsa-lib sources | |
working-directory: /tmp | |
run: | | |
wget http://www.alsa-project.org/files/pub/lib/alsa-lib-1.2.10.tar.bz2 | |
tar -xvf alsa-lib-1.2.10.tar.bz2 | |
- name: Cross-compile alsa-lib for ${{ matrix.target }} | |
working-directory: /tmp | |
run: | | |
cd alsa-lib-1.2.10 | |
./configure --enable-shared=yes --enable-static=no --with-pic \ | |
--host=${{ matrix.target }} --prefix=/tmp/deps/${{ matrix.target }} | |
make | |
sudo make install | |
- name: Download libogg sources | |
working-directory: /tmp | |
run: | | |
wget https://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.xz | |
tar -xvf libogg-1.3.5.tar.xz | |
- name: Cross-compile libogg for ${{ matrix.target }} | |
working-directory: /tmp | |
run: | | |
cd libogg-1.3.5 | |
./configure --host=${{ matrix.target }} --prefix=/tmp/deps/${{ matrix.target }} | |
make | |
sudo make install | |
- name: Download libvorbis sources | |
working-directory: /tmp | |
run: | | |
wget https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz | |
tar -xvf libvorbis-1.3.7.tar.xz | |
- name: Cross-compile libvorbis for ${{ matrix.target }} | |
working-directory: /tmp | |
run: | | |
cd libvorbis-1.3.7 | |
./configure --host=${{ matrix.target }} --prefix=/tmp/deps/${{ matrix.target }} | |
make | |
sudo make install | |
- name: Package dependencies | |
run: mkdir /tmp/out && tar -C /tmp/deps -cvf /tmp/out/${{ matrix.target }}.tar ${{ matrix.target }} | |
- name: Upload compiled dependencies | |
uses: actions/upload-artifact@v3 | |
with: | |
name: deps | |
path: /tmp/out | |
retention-days: 1 | |
build: | |
runs-on: ubuntu-20.04 | |
needs: | |
- build-deps | |
strategy: | |
matrix: | |
include: | |
- target: amd64 | |
goarch: amd64 | |
goamd64: v1 | |
cc: gcc | |
tar: linux_x86_64 | |
- target: arm-rpi-linux-gnueabihf | |
goarch: arm | |
goarm: 6 | |
cc: arm-rpi-linux-gnueabihf-gcc | |
tar: linux_armv6_rpi | |
- target: arm-linux-gnueabihf | |
goarch: arm | |
goarm: 6 | |
cc: arm-linux-gnueabihf-gcc | |
tar: linux_armv6 | |
- target: aarch64-linux-gnu | |
goarch: arm64 | |
cc: aarch64-linux-gnu-gcc | |
tar: linux_arm64 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: git fetch --force --tags | |
- name: Set up Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
- name: Download compiled dependencies | |
uses: actions/download-artifact@v3 | |
if: ${{ matrix.target != 'amd64' }} | |
with: | |
name: deps | |
path: /tmp/deps | |
- name: Unpack compiled dependencies | |
if: ${{ matrix.target != 'amd64' }} | |
run: sudo mkdir /usr/${{ matrix.target }} && sudo tar -C /usr/${{ matrix.target }} --strip-components=1 -xvf /tmp/deps/${{ matrix.target }}.tar | |
- name: Install dependencies | |
if: ${{ matrix.target == 'amd64' }} | |
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libogg-dev libvorbis-dev | |
- name: Install build dependencies | |
if: ${{ matrix.target != 'amd64' && matrix.target != 'arm-rpi-linux-gnueabihf' }} | |
run: sudo apt-get install -y gcc-${{ matrix.target }} | |
- name: Install build dependencies for arm-rpi-linux-gnueabihf | |
if: ${{ matrix.target == 'arm-rpi-linux-gnueabihf' }} | |
working-directory: /tmp | |
run: | | |
wget https://github.com/devgianlu/rpi-toolchain/releases/download/v1/arm-rpi-linux-gnueabihf.tar.gz | |
sudo tar -C /usr --strip-components=1 -xzf arm-rpi-linux-gnueabihf.tar.gz | |
- name: Build with Go | |
env: | |
CGO_ENABLED: 1 | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
GOARM: ${{ matrix.goarm }} | |
GOAMD64: ${{ matrix.goamd64 }} | |
CC: ${{ matrix.cc }} | |
PKG_CONFIG_PATH: /usr/${{ matrix.target }}/lib/pkgconfig/ | |
run: | | |
mkdir -p /tmp/out/${{ matrix.target }}/ | |
go build \ | |
-ldflags="-s -w -X go-librespot.commit={{.ShortCommit}} -X go-librespot.version={{.Version}}" \ | |
-o ./go-librespot ./cmd/daemon | |
tar -zcvf /tmp/out/go-librespot_${{ matrix.tar }}.tar.gz go-librespot README.md | |
- name: Upload compiled binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binaries | |
path: /tmp/out | |
retention-days: 1 | |
publish: | |
runs-on: ubuntu-20.04 | |
needs: | |
- build | |
steps: | |
- name: Download compiled binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: binaries | |
path: /tmp/out | |
- name: Release binaries | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: /tmp/out/* |