Skip to content

v0.0.3-beta

v0.0.3-beta #16

Workflow file for this run

name: Build and release
on:
release:
types: [created]
defaults:
run:
# This otherwise gets run under dash which does not support brace expansion
shell: bash
env:
binary_name: dm_rat
plugin_name: dm-Rat
jobs:
package-nih-plug:
strategy:
matrix:
include:
- { name: ubuntu, os: ubuntu-latest, cross-target: "" }
- { name: macos, os: macos-latest, cross-target: x86_64-apple-darwin }
- { name: windows, os: windows-latest, cross-target: "" }
name: Package nih-plug binaries
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Fetch all git history
run: git fetch --force --prune --tags --unshallow
- name: Install dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev libgl-dev libjack-dev libx11-xcb-dev libxcb1-dev libxcb-dri2-0-dev libxcb-icccm4-dev libxcursor-dev libxkbcommon-dev libxcb-shape0-dev libxcb-xfixes0-dev
- uses: actions/cache@v4
# FIXME: Caching `target/` causes the Windows runner to blow up after some time
if: startsWith(matrix.os, 'windows')
with:
path: |
~/nih-plug/.cargo/registry/index/
~/nih-plug/.cargo/registry/cache/
~/nih-plug/.cargo/git/db/
key: ${{ matrix.name }}-${{ matrix.cross-target }}
- uses: actions/cache@v4
if: startsWith(matrix.os, 'windows') != true
with:
path: |
~/nih-plug/.cargo/registry/index/
~/nih-plug/.cargo/registry/cache/
~/nih-plug/.cargo/git/db/
target/
key: ${{ matrix.name }}-${{ matrix.cross-target }}
- name: Set up Rust toolchain
# Needed for SIMD
uses: dtolnay/rust-toolchain@nightly
with:
# The macOS x86_64 build is done from an AArch64 macOS CI runner, so
# it needs to be cross compiled
targets: ${{ matrix.cross-target }}
- name: Build nih-plug
working-directory: ./nih-plug
run: |
runner_name=${{ matrix.name }}
if [[ $runner_name = 'macos' ]]; then
export MACOSX_DEPLOYMENT_TARGET=10.13
cargo xtask bundle-universal $binary_name --release
else
cross_target=${{ matrix.cross-target }}
if [[ -n $cross_target ]]; then
cargo xtask bundle $binary_name --release --target $cross_target
else
cargo xtask bundle $binary_name --release
fi
fi
- name: Determine build archive name
run: |
# Windows (usually) doesn't like colons in file names
echo "ARCHIVE_NAME=$plugin_name-${{ matrix.name }}" >> "$GITHUB_ENV"
- name: Move all packaged plugin into a directory
run: |
mkdir -p $ARCHIVE_NAME
mv ./nih-plug/target/bundled/* $ARCHIVE_NAME
- name: Rename plugins
run: |
for file_name in $ARCHIVE_NAME/$binary_name.*;
do mv $file_name "${file_name/$binary_name/$plugin_name}";
done
- name: Add an OS-specific readme file with installation instructions
run: cp ".github/workflows/readme-${{ runner.os }}.txt" "$ARCHIVE_NAME/README.txt"
- name: Zip files
run: tar -cf $ARCHIVE_NAME.zip $ARCHIVE_NAME
- name: Add zip to release
uses: softprops/action-gh-release@v2
with:
name: ${{github.ref_name}}
files: ${{ env.ARCHIVE_NAME }}.zip