Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
OseMine committed Nov 11, 2024
0 parents commit d07cdca
Show file tree
Hide file tree
Showing 14 changed files with 1,495 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --release --"
81 changes: 81 additions & 0 deletions .github/workflows/automated-prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Create Automated Pre-release

on:
workflow_run:
workflows: ["Automated Builds"]
types:
- completed

permissions:
contents: write
pull-requests: write

jobs:
create-prerelease:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get latest commit info
id: commit_info
run: |
echo "message=$(git log -1 --pretty=%B)" >> $GITHUB_OUTPUT
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Generate changelog
id: changelog
run: |
changelog=$(git log --pretty=format:"- %s (%h)" $(git describe --tags --abbrev=0)..HEAD)
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$changelog" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create pre-release tag
id: create_tag
run: |
tag_name="prerelease-$(date +'%Y%m%d-%H%M%S')"
git tag $tag_name
git push origin $tag_name
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
with:
path: ./artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Prepare artifacts for release
run: |
mkdir release_artifacts
for dir in ./artifacts/nih-plugs-*; do
if [ -d "$dir" ]; then
zip_name=$(basename "$dir").zip
(cd "$dir" && zip -r "../../release_artifacts/$zip_name" .)
fi
done
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.create_tag.outputs.tag_name }}
name: "Pre-release ${{ steps.create_tag.outputs.tag_name }}"
body: |
This is an automated pre-release based on the latest commit:
Commit Message: ${{ steps.commit_info.outputs.message }}
Commit SHA: ${{ steps.commit_info.outputs.sha }}
[Full Changelog](https://github.com/OseMine/variable-effects/commits/)
Changes since last release:
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "./release_artifacts/*.zip"
111 changes: 111 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Automated Builds

on:
push:
branches:
- '**'
tags:
- '*'
pull_request:
branches:
- master

defaults:
run:
shell: bash

jobs:
package:
strategy:
matrix:
include:
- { name: ubuntu-20.04, os: ubuntu-20.04, cross-target: '' }
- { name: macos-universal, os: macos-13, cross-target: aarch64-apple-darwin }
- { name: windows, os: windows-latest, cross-target: '' }
name: Package plugin 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
if: startsWith(matrix.os, 'windows')
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ matrix.name }}-${{ matrix.cross-target }}
- uses: actions/cache@v4
if: "!startsWith(matrix.os, 'windows')"
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.name }}-${{ matrix.cross-target }}

- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.cross-target }}

- name: Package all targets from bundler.toml
run: |
runner_name=${{ matrix.name }}
package_args=("-p" "variable-effects") # Explicitly specify the main package
if [[ $runner_name = 'macos-universal' ]]; then
export MACOSX_DEPLOYMENT_TARGET=10.13
cargo xtask bundle-universal "${package_args[@]}" --release
else
cross_target=${{ matrix.cross-target }}
if [[ -n $cross_target ]]; then
package_args+=("--target" "$cross_target")
fi
cargo xtask bundle "${package_args[@]}" --release
fi
- name: Determine build archive name
run: |
ARCHIVE_NAME="nih-plugs-$(date -u +"%Y-%m-%d-%H%M%S")-${{ matrix.name }}"
echo "ARCHIVE_NAME=$ARCHIVE_NAME" >> "$GITHUB_ENV"
- name: Move all packaged plugin into a directory
run: |
mkdir -p "$ARCHIVE_NAME/$ARCHIVE_NAME"
mv target/bundled/* "$ARCHIVE_NAME/$ARCHIVE_NAME"
- name: Add an OS-specific readme file with installation instructions
run: |
README_FILE=".github/workflows/readme-${{ matrix.name == 'ubuntu-20.04' && 'Linux' || matrix.name }}.txt"
if [[ -f "$README_FILE" ]]; then
cp "$README_FILE" "$ARCHIVE_NAME/$ARCHIVE_NAME/README.txt"
else
echo "No specific README file found for ${{ matrix.name }}"
fi
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.4.3
with:
name: ${{ env.ARCHIVE_NAME }}
path: ${{ env.ARCHIVE_NAME }}
if-no-files-found: error

download_artifact:
runs-on: ubuntu-latest
needs: package
steps:
- name: Download a Build Artifact
uses: actions/download-artifact@v4.1.8
with:
name: ${{ env.ARCHIVE_NAME }}
path: ./downloads
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
Loading

0 comments on commit d07cdca

Please sign in to comment.