prepare release (#1332) #14
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: Continuous Deployment | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build: | |
name: Building ${{matrix.os}}-${{ matrix.arch }} (${{ matrix.artifact_type }}) | |
runs-on: ${{ matrix.runs_on }} | |
strategy: | |
matrix: | |
os: [macos, linux] | |
arch: [x86_64, aarch64, armv7] | |
rust: [stable] | |
artifact_type: ['slim', 'default', 'full'] # The build strategy will build all types for each OS specified | |
include: | |
# Runner configuration | |
- os: macos | |
arch: x86_64 | |
runs_on: macos-13 | |
- os: macos | |
arch: aarch64 | |
runs_on: macos-latest | |
- os: linux | |
runs_on: ubuntu-latest | |
# DBus configuration | |
- artifact_type: slim | |
dbus: '' | |
- artifact_type: default | |
dbus: dbus_mpris | |
- artifact_type: full | |
dbus: dbus_mpris | |
# Cross Compilation Targets | |
- os: linux | |
arch: aarch64 | |
target: aarch64-unknown-linux-gnu | |
- os: linux | |
arch: armv7 | |
target: armv7-unknown-linux-gnueabihf | |
# Audio backend configuration: Linux | |
- os: linux | |
artifact_type: slim | |
audio_backends: alsa_backend | |
- os: linux | |
artifact_type: default | |
audio_backends: alsa_backend,pulseaudio_backend,rodio_backend | |
- os: linux | |
artifact_type: full | |
audio_backends: alsa_backend,pulseaudio_backend,rodio_backend,rodiojack_backend | |
# Audio backend configuration: macOS | |
- os: macos | |
audio_backends: portaudio_backend,rodio_backend | |
exclude: | |
- os: macos | |
artifact_type: 'full' | |
- os: macos | |
arch: armv7 | |
steps: | |
- name: Checking out sources | |
uses: actions/checkout@v4 | |
- name: Installing needed macOS dependencies | |
if: matrix.os == 'macos' | |
run: brew install dbus portaudio | |
- name: Installing needed Ubuntu dependencies | |
if: startsWith(matrix.runs_on, 'ubuntu') && matrix.target == '' | |
run: | | |
sudo apt-get update | |
# alsa_backend,rodio_backend and base deps | |
sudo apt-get install -y libasound2-dev libssl-dev libclang-dev clang | |
# dbus_mpris | |
sudo apt-get install -y libdbus-1-dev | |
# pulseaudio_backend | |
sudo apt-get install -y libpulse-dev | |
# portaudio_backend | |
sudo apt-get install -y portaudio19-dev | |
- name: Determine cargo args | |
run: | | |
features="--no-default-features --features ${{ matrix.dbus }},${{ matrix.audio_backends }}" | |
echo CARGO_ARGS="--locked --release $features" | tee -a "$GITHUB_ENV" | |
- name: Build (using cargo) | |
if: matrix.target == '' | |
run: | | |
cargo +${{ matrix.rust }} build $CARGO_ARGS | |
- name: Build (using cross) | |
if: matrix.target != '' | |
uses: houseabsolute/actions-rust-cross@v1 | |
with: | |
cross-version: 49338b1 # currently needed (check again if cross version > 0.2.5) | |
command: build | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.target }} | |
args: $CARGO_ARGS | |
- name: Uploading artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spotifyd-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.artifact_type }} | |
path: target/${{ matrix.target }}/release/spotifyd | |
release: # only runs when a version tag is pushed | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Downloading artifacts # download all binaries | |
uses: actions/download-artifact@v4 | |
- name: Packaging final binary | |
shell: bash | |
run: | | |
for artifact_dir in ./*/ | |
do | |
pushd $artifact_dir | |
artifact_name=$(basename $artifact_dir) | |
tar czvf $artifact_name.tar.gz spotifyd | |
shasum -a 512 $artifact_name.tar.gz > $artifact_name.sha512 | |
popd | |
done | |
- name: Releasing assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
**/*.tar.gz | |
**/*.sha512 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |