Skip to content

Merge pull request #8 from LargeModGames/beta #49

Merge pull request #8 from LargeModGames/beta

Merge pull request #8 from LargeModGames/beta #49

Workflow file for this run

name: Continuous Deployment
on:
push:
tags:
- "v*.*.*"
env:
CARGO_TERM_COLOR: always
BINARY_NAME: spotatui
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_prefix: linux-x86_64 # most Linux distros
binary_postfix: ""
audio_features: "audio-viz"
- os: macos-latest
target: x86_64-apple-darwin
artifact_prefix: macos-x86_64
binary_postfix: ""
audio_features: "audio-viz-cpal"
- os: macos-latest
target: aarch64-apple-darwin
artifact_prefix: macos-aarch64
binary_postfix: ""
audio_features: "audio-viz-cpal"
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_prefix: windows-x86_64
binary_postfix: ".exe"
audio_features: "audio-viz-cpal"
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libpipewire-0.3-dev libspa-0.2-dev libasound2-dev
- name: Install macOS dependencies
if: runner.os == 'macOS'
run: brew install openssl@3
- name: Build release binary
run: |
if [ -z "${{ matrix.audio_features }}" ]; then
cargo build --release --target ${{ matrix.target }} --no-default-features --features telemetry,streaming
else
cargo build --release --target ${{ matrix.target }} --no-default-features --features telemetry,streaming,${{ matrix.audio_features }}
fi
shell: bash
- name: Package binary (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
cd target/${{ matrix.target }}/release
BINARY=${{ env.BINARY_NAME }}${{ matrix.binary_postfix }}
strip $BINARY || true
RELEASE_NAME=${{ env.BINARY_NAME }}-${{ matrix.artifact_prefix }}
tar czvf ../../../$RELEASE_NAME.tar.gz $BINARY
cd ../../..
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.tar.gz.sha256
- name: Package binary (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
cd target/${{ matrix.target }}/release
BINARY=${{ env.BINARY_NAME }}${{ matrix.binary_postfix }}
RELEASE_NAME=${{ env.BINARY_NAME }}-${{ matrix.artifact_prefix }}
7z a ../../../$RELEASE_NAME.zip $BINARY
cd ../../..
certutil -hashfile $RELEASE_NAME.zip sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.zip.sha256
- name: Upload artifact (Unix)
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ env.BINARY_NAME }}-${{ matrix.artifact_prefix }}
path: |
${{ env.BINARY_NAME }}-${{ matrix.artifact_prefix }}.tar.gz
${{ env.BINARY_NAME }}-${{ matrix.artifact_prefix }}.tar.gz.sha256
- name: Upload artifact (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ env.BINARY_NAME }}-${{ matrix.artifact_prefix }}
path: |
${{ env.BINARY_NAME }}-${{ matrix.artifact_prefix }}.zip
${{ env.BINARY_NAME }}-${{ matrix.artifact_prefix }}.zip.sha256
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true
body: |
## Downloads
- On **Windows 10/11 (64-bit)** → `spotatui-windows-x86_64.zip`
- On **Linux (Ubuntu, Arch, Fedora, etc.)** → `spotatui-linux-x86_64.tar.gz`
- On **macOS with Intel CPU** → `spotatui-macos-x86_64.tar.gz`
- On **macOS with Apple Silicon (M1/M2/M3)** → `spotatui-macos-aarch64.tar.gz`
Checksums (`.sha256`) are optional and only needed if you want to verify the download.
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-cargo:
name: Publish to crates.io
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --allow-dirty
publish-aur:
name: Publish to AUR
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Extract version
id: version
run: |
VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Calculate SHA256
id: sha256
run: |
TARBALL_URL="https://github.com/${{ github.repository }}/archive/refs/tags/v${{ steps.version.outputs.version }}.tar.gz"
SHA256=$(curl -sL "$TARBALL_URL" | sha256sum | awk '{print $1}')
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
echo "SHA256: $SHA256"
- name: Setup SSH for AUR
run: |
mkdir -p ~/.ssh
echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/aur
chmod 600 ~/.ssh/aur
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
git config --global user.name "${{ secrets.AUR_USERNAME }}"
git config --global user.email "${{ secrets.AUR_EMAIL }}"
- name: Clone AUR repository
run: |
GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes' git clone ssh://aur@aur.archlinux.org/spotatui.git aur
- name: Update PKGBUILD
working-directory: aur
run: |
sed -i "s/^pkgver=.*/pkgver=${{ steps.version.outputs.version }}/" PKGBUILD
sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD
sed -i "s/^sha256sums=.*/sha256sums=('${{ steps.sha256.outputs.sha256 }}')/" PKGBUILD
- name: Generate .SRCINFO
working-directory: aur
run: |
docker run --rm -v $PWD:/pkg archlinux:latest /bin/bash -c "
pacman -Syu --noconfirm --needed base-devel &&
useradd -m builder &&
chown -R builder:builder /pkg &&
cd /pkg &&
su builder -c 'makepkg --printsrcinfo' > .SRCINFO
"
sudo chown -R $(id -u):$(id -g) .
- name: Commit and push to AUR
working-directory: aur
run: |
git add PKGBUILD .SRCINFO
git commit -m "Update to ${{ steps.version.outputs.version }}"
GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes' git push