Skip to content

Release

Release #27

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release (e.g. v0.5.0)'
required: false
type: string
permissions:
contents: write
env:
VCPKG_COMMIT: 45f9f39362a4c52e2b1fbe57b7e649db7f3d96d4
jobs:
build-release:
name: Build and Release Binary
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libwayland-dev \
wayland-protocols \
libxkbcommon-dev \
libegl-dev \
libgles-dev \
libx11-dev \
libasound2-dev \
libudev-dev \
pkg-config \
cmake \
ninja-build \
nasm
- name: Cache vcpkg binary archives (files provider)
# x-gha was removed from vcpkg in April 2025 (microsoft/vcpkg-tool#1662).
# The recommended replacement for GitHub Actions is a filesystem cache
# via VCPKG_BINARY_SOURCES=clear;files,<path>,readwrite + actions/cache
# on that path. We cache the archives (per-port zip files) in the
# workspace, not inside /opt/vcpkg, so a fresh `git clone` of the
# tool doesn't wipe the cache.
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.vcpkg-cache
key: wallr-vcpkg-archives-${{ runner.os }}-${{ env.VCPKG_COMMIT }}-${{ hashFiles('.github/vcpkg-triplets/**') }}
restore-keys: |
wallr-vcpkg-archives-${{ runner.os }}-${{ env.VCPKG_COMMIT }}-
wallr-vcpkg-archives-${{ runner.os }}-
- name: Install vcpkg
run: |
if [ -d /opt/vcpkg/.git ]; then
echo "vcpkg already present from cache, updating"
git -C /opt/vcpkg fetch --depth 1 origin "$VCPKG_COMMIT"
git -C /opt/vcpkg checkout "$VCPKG_COMMIT"
else
sudo rm -rf /opt/vcpkg
git clone --depth 1 --branch master https://github.com/microsoft/vcpkg /opt/vcpkg
git -C /opt/vcpkg fetch --depth 1 origin "$VCPKG_COMMIT"
git -C /opt/vcpkg checkout "$VCPKG_COMMIT"
fi
/opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics
- name: Build static FFmpeg
env:
VCPKG_ROOT: /opt/vcpkg
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/.vcpkg-cache,readwrite"
run: |
mkdir -p "${{ github.workspace }}/.vcpkg-cache"
/opt/vcpkg/vcpkg install \
'ffmpeg[core,avcodec,avformat,swscale,swresample]:x64-linux-static' \
--overlay-triplets="$GITHUB_WORKSPACE/.github/vcpkg-triplets"
- name: Install stable Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
with:
# No custom `key` override: rust-cache hashes Cargo.lock, the Rust
# toolchain version, and the job's `runs-on` automatically. A fixed
# key here (as in the original) never changes, so it restores the
# same snapshot forever and never saves a fresh one after the
# first run; this is the actual caching bug in the original file.
# rust-cache's default env-vars list ("CARGO CC CFLAGS CXX CMAKE
# RUST") already matches PKG_CONFIG_ALL_STATIC's C-toolchain
# neighbors but not the two FFmpeg linkage vars themselves, since
# matching is by *prefix*: MEDIA_PREFIX and PKG_CONFIG_PATH share
# no prefix with any default entry. Add both explicitly (alongside
# the defaults, since setting env-vars replaces rather than
# extends them) so a vcpkg triplet edit that changes either path
# can't silently reuse stale linked artifacts.
env-vars: CARGO CC CFLAGS CXX CMAKE RUST MEDIA_PREFIX PKG_CONFIG
shared-key: release-static-ffmpeg
- name: Build release binary with static FFmpeg
env:
MEDIA_PREFIX: /opt/vcpkg/installed/x64-linux-static
PKG_CONFIG_PATH: /opt/vcpkg/installed/x64-linux-static/lib/pkgconfig
PKG_CONFIG_ALL_STATIC: "1"
run: cargo build --release --bin wallr --features static-ffmpeg
- name: Verify binary is self-contained
run: |
set -euo pipefail
BIN=target/release/wallr
if [ ! -x "$BIN" ]; then
echo "ERROR: $BIN not found or not executable; build did not produce a binary"
exit 1
fi
if ldd "$BIN" | grep -qE 'libav(a|util|codec|format|sw)'; then
echo "ERROR: binary links dynamic FFmpeg libraries"
ldd "$BIN"
exit 1
fi
echo "OK: no dynamic FFmpeg dependencies"
- name: Prepare Release Asset
run: |
set -euo pipefail
mkdir -p staging
cp target/release/wallr staging/
cp README.md staging/
cp -r docs staging/
cd staging
tar -czf ../wallr-linux-amd64.tar.gz *
cd ..
- name: Determine Tag
id: determine_tag
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.tag_name }}" ]; then
TAG_NAME="${{ inputs.tag_name }}"
elif [ "${{ github.ref_type }}" = "tag" ]; then
TAG_NAME="${{ github.ref_name }}"
else
VERSION="$(cargo metadata --no-deps --format-version 1 | jq -re '.packages[] | select(.name=="wallr") | .version')"
if [ -z "$VERSION" ]; then
echo "ERROR: could not resolve wallr's version from cargo metadata" >&2
exit 1
fi
TAG_NAME="v${VERSION}"
fi
echo "TAG_NAME=${TAG_NAME}" >> "$GITHUB_ENV"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG_NAME }}
name: Release ${{ env.TAG_NAME }}
draft: false
prerelease: false
files: |
wallr-linux-amd64.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}