Skip to content

Commit

Permalink
Update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveRussell33 committed Apr 21, 2022
1 parent 68a35ba commit e7f8740
Showing 1 changed file with 62 additions and 36 deletions.
98 changes: 62 additions & 36 deletions .github/workflows/build-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,101 @@ name: Build VCV Rack Plugin
on: [push, pull_request]

env:
rack-sdk-version: 2.1.0
rack-sdk-version: 2.0.6
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@v3
- uses: actions/cache@v2
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:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.platform }}
needs: modify-plugin-version
runs-on: ubuntu-latest
container:
image: ghcr.io/qno/rack-plugin-toolchain-win-linux:v2
options: --user root
strategy:
matrix:
config:
- {
name: Linux,
sdk-platform: lin,
os: ubuntu-latest,
prepare-os: sudo apt update && sudo apt install -y libglu-dev
}
- {
name: MacOS,
sdk-platform: mac,
os: macos-latest,
prepare-os: ""
}
- {
name: Windows,
sdk-platform: win,
os: windows-latest,
prepare-os: export CC=gcc
}
platform: [win, linux]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/cache@v2
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 }}
make plugin-build-${{ matrix.platform }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
path: ${{ env.rack-plugin-toolchain-dir }}/plugin-build
name: ${{ matrix.platform }}

build-mac:
name: mac
needs: modify-plugin-version
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/cache@v2
id: plugin-version-cache
with:
path: plugin.json
key: ${{ github.sha }}-${{ github.run_id }}
- name: Get Rack-SDK
run: |
pushd $HOME
curl -o Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-${{ matrix.config.sdk-platform }}.zip
curl -o Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-mac.zip
unzip Rack-SDK.zip
- name: Modify plugin version
# only modify plugin version if no tag was created
if: "! startsWith(github.ref, 'refs/tags/v')"
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
- name: Build plugin
run: |
${{ matrix.config.prepare-os }}
export RACK_DIR=$HOME/Rack-SDK
make -j dep
make -j dist
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
path: dist
name: ${{ matrix.config.name }}
name: mac

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
needs: [build, build-mac]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: FranzDiebold/[email protected]
- name: Check if plugin version matches tag
run: |
Expand Down

0 comments on commit e7f8740

Please sign in to comment.