build.yml (4274B)
1 name: Build VCV Rack Plugin 2 on: [push, pull_request] 3 4 env: 5 rack-sdk-version: latest 6 rack-plugin-toolchain-dir: /home/build/rack-plugin-toolchain 7 8 defaults: 9 run: 10 shell: bash 11 12 jobs: 13 14 modify-plugin-version: 15 name: Modify plugin version 16 runs-on: ubuntu-latest 17 steps: 18 - uses: actions/checkout@v4 19 - uses: actions/cache@v4 20 id: plugin-version-cache 21 with: 22 path: plugin.json 23 key: ${{ github.sha }}-${{ github.run_id }} 24 - run: | 25 gitrev=`git rev-parse --short HEAD` 26 pluginversion=`jq -r '.version' plugin.json` 27 echo "Set plugin version from $pluginversion to $pluginversion-$gitrev" 28 cat <<< `jq --arg VERSION "$pluginversion-$gitrev" '.version=$VERSION' plugin.json` > plugin.json 29 # only modify plugin version if no tag was created 30 if: "! startsWith(github.ref, 'refs/tags/v')" 31 32 build: 33 name: ${{ matrix.platform }} 34 needs: modify-plugin-version 35 runs-on: ubuntu-latest 36 container: 37 image: ghcr.io/qno/rack-plugin-toolchain-win-linux 38 options: --user root 39 strategy: 40 matrix: 41 platform: [win-x64, lin-x64] 42 steps: 43 - uses: actions/checkout@v4 44 with: 45 submodules: recursive 46 - uses: actions/cache@v4 47 id: plugin-version-cache 48 with: 49 path: plugin.json 50 key: ${{ github.sha }}-${{ github.run_id }} 51 - name: Build plugin 52 run: | 53 export PLUGIN_DIR=$GITHUB_WORKSPACE 54 pushd ${{ env.rack-plugin-toolchain-dir }} 55 make plugin-build-${{ matrix.platform }} 56 - name: Upload artifact 57 uses: actions/upload-artifact@v4 58 with: 59 path: ${{ env.rack-plugin-toolchain-dir }}/plugin-build 60 name: ${{ matrix.platform }} 61 62 build-mac: 63 name: mac 64 needs: modify-plugin-version 65 runs-on: macos-latest 66 strategy: 67 fail-fast: false 68 matrix: 69 platform: [x64, arm64] 70 steps: 71 - uses: actions/checkout@v4 72 with: 73 submodules: recursive 74 - uses: actions/cache@v4 75 id: plugin-version-cache 76 with: 77 path: plugin.json 78 key: ${{ github.sha }}-${{ github.run_id }} 79 - name: Get Rack-SDK 80 run: | 81 pushd $HOME 82 wget -O Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-mac-x64+arm64.zip 83 unzip Rack-SDK.zip 84 - name: Build plugin 85 run: | 86 CROSS_COMPILE_TARGET_x64=x86_64-apple-darwin 87 CROSS_COMPILE_TARGET_arm64=arm64-apple-darwin 88 export RACK_DIR=$HOME/Rack-SDK 89 export CROSS_COMPILE=$CROSS_COMPILE_TARGET_${{ matrix.platform }} 90 make dep 91 make dist 92 - name: Upload artifact 93 uses: actions/upload-artifact@v4 94 with: 95 path: dist/*.vcvplugin 96 name: mac-${{ matrix.platform }} 97 98 publish: 99 name: Publish plugin 100 # only create a release if a tag was created that is called e.g. v1.2.3 101 # see also https://vcvrack.com/manual/Manifest#version 102 if: startsWith(github.ref, 'refs/tags/v') 103 runs-on: ubuntu-latest 104 needs: [build, build-mac] 105 steps: 106 - uses: actions/checkout@v4 107 - uses: FranzDiebold/github-env-vars-action@v2 108 - name: Check if plugin version matches tag 109 run: | 110 pluginversion=`jq -r '.version' plugin.json` 111 if [ "v$pluginversion" != "${{ env.CI_REF_NAME }}" ]; then 112 echo "Plugin version from plugin.json 'v$pluginversion' doesn't match with tag version '${{ env.CI_REF_NAME }}'" 113 exit 1 114 fi 115 - name: Create Release 116 uses: softprops/action-gh-release@v1 117 with: 118 tag_name: ${{ github.ref }} 119 name: Release ${{ env.CI_REF_NAME }} 120 body: | 121 ${{ env.CI_REPOSITORY_NAME }} VCV Rack Plugin ${{ env.CI_REF_NAME }} 122 draft: false 123 prerelease: false 124 - uses: actions/download-artifact@v4 125 with: 126 path: _artifacts 127 - name: Upload release assets 128 uses: svenstaro/upload-release-action@v2 129 with: 130 repo_token: ${{ secrets.GITHUB_TOKEN }} 131 file: _artifacts/**/*.vcvplugin 132 tag: ${{ github.ref }} 133 file_glob: true