Browse Source

Refactor GitHub Actions workflow for plugin build

Removed the modify-plugin-version job and adjusted build jobs for Windows and macOS. Updated paths and environment variables for the build process.
pull/79/head
András Szabó GitHub 3 weeks ago
parent
commit
3944f93807
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 81 deletions
  1. +20
    -81
      .github/workflows/build.yml

+ 20
- 81
.github/workflows/build.yml View File

@@ -1,5 +1,4 @@
name: Build VCV Rack Plugin
# on: [push, pull_request]
on:
push:
paths:
@@ -9,35 +8,14 @@ on:

env:
rack-sdk-version: latest
rack-plugin-toolchain-dir: /home/build/rack-plugin-toolchain

defaults:
run:
shell: bash

jobs:

modify-plugin-version:
name: Modify plugin version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: plugin-version-cache
with:
path: plugin.json
key: ${{ github.sha }}-${{ github.run_id }}
- run: |
gitrev=`git rev-parse --short HEAD`
pluginversion=`jq -r '.version' plugin.json`
echo "Set plugin version from $pluginversion to $pluginversion-$gitrev"
cat <<< `jq --arg VERSION "$pluginversion-$gitrev" '.version=$VERSION' plugin.json` > plugin.json
# only modify plugin version if no tag was created
if: "! startsWith(github.ref, 'refs/tags/v')"

build:
build-windows-linux:
name: ${{ matrix.platform }}
needs: modify-plugin-version
runs-on: ubuntu-latest
container:
image: ghcr.io/stevenussell33/rack-plugin-toolchain-win-linux
@@ -49,26 +27,20 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
id: plugin-version-cache
with:
path: plugin.json
key: ${{ github.sha }}-${{ github.run_id }}
- name: Build plugin
run: |
export PLUGIN_DIR=$GITHUB_WORKSPACE
pushd ${{ env.rack-plugin-toolchain-dir }}
export RACK_DIR=/home/build/rack-plugin-toolchain/Rack-SDK
pushd /home/build/rack-plugin-toolchain
make plugin-build-${{ matrix.platform }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: ${{ env.rack-plugin-toolchain-dir }}/plugin-build
path: /home/build/rack-plugin-toolchain/plugin-build
name: ${{ matrix.platform }}

build-mac:
if: false # <-- Add this line to disable the job
name: mac
needs: modify-plugin-version
runs-on: macos-latest
strategy:
fail-fast: false
@@ -78,63 +50,30 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
id: plugin-version-cache
with:
path: plugin.json
key: ${{ github.sha }}-${{ github.run_id }}
- name: Get Rack-SDK
run: |
pushd $HOME
wget -O Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-mac-x64+arm64.zip
unzip Rack-SDK.zip
mkdir -p $HOME/Rack-SDK
pushd $HOME/Rack-SDK
# SDK 2.6.0+ requires separate downloads for x64 and arm64
if [ "${{ matrix.platform }}" = "x64" ]; then
wget -O Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-mac-x64.zip
else
wget -O Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-mac-arm64.zip
fi
unzip -q Rack-SDK.zip
rm Rack-SDK.zip
- name: Build plugin
run: |
CROSS_COMPILE_TARGET_x64=x86_64-apple-darwin
CROSS_COMPILE_TARGET_arm64=arm64-apple-darwin
export RACK_DIR=$HOME/Rack-SDK
export CROSS_COMPILE=$CROSS_COMPILE_TARGET_${{ matrix.platform }}
if [ "${{ matrix.platform }}" = "x64" ]; then
export CROSS_COMPILE=x86_64-apple-darwin
else
export CROSS_COMPILE=arm64-apple-darwin
fi
make dep
make dist
make
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: dist/*.vcvplugin
name: mac-${{ matrix.platform }}

publish:
name: Publish plugin
# only create a release if a tag was created that is called e.g. v1.2.3
# see also https://vcvrack.com/manual/Manifest#version
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [build, build-mac]
steps:
- uses: actions/checkout@v4
- uses: FranzDiebold/github-env-vars-action@v2
- name: Check if plugin version matches tag
run: |
pluginversion=`jq -r '.version' plugin.json`
if [ "v$pluginversion" != "${{ env.CI_REF_NAME }}" ]; then
echo "Plugin version from plugin.json 'v$pluginversion' doesn't match with tag version '${{ env.CI_REF_NAME }}'"
exit 1
fi
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref }}
name: Release ${{ env.CI_REF_NAME }}
body: |
${{ env.CI_REPOSITORY_NAME }} VCV Rack Plugin ${{ env.CI_REF_NAME }}
draft: false
prerelease: false
- uses: actions/download-artifact@v4
with:
path: _artifacts
- name: Upload release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: _artifacts/**/*.vcvplugin
tag: ${{ github.ref }}
file_glob: true

Loading…
Cancel
Save