fixes for metamodule #146
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build VCV Rack Plugin | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'README*' | |
| - 'doc/**' | |
| - 'design/**' | |
| - 'dev/**' | |
| pull_request: | |
| 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 | |
| if: "! startsWith(github.ref, 'refs/tags/v')" | |
| build: | |
| name: ${{ matrix.platform }} | |
| needs: modify-plugin-version | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/qno/rack-plugin-toolchain-win-linux | |
| options: --user root | |
| strategy: | |
| matrix: | |
| platform: [win-x64, lin-x64] | |
| steps: | |
| - 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 }} | |
| make plugin-build-${{ matrix.platform }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: ${{ env.rack-plugin-toolchain-dir }}/plugin-build | |
| name: ${{ matrix.platform }} | |
| overwrite: true | |
| build-mac: | |
| name: mac | |
| needs: modify-plugin-version | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [x64, arm64] | |
| env: | |
| rack-sdk-version: 2.6.4 | |
| steps: | |
| - 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 | |
| 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 -o Rack-SDK.zip | |
| - name: Build plugin (with correct architecture) | |
| run: | | |
| export RACK_DIR=$HOME/Rack-SDK | |
| make clean | |
| make dep | |
| if [[ "${{ matrix.platform }}" == "x64" ]]; then | |
| # Use Rosetta to build x64 binary | |
| arch -x86_64 make dist | |
| else | |
| make dist | |
| fi | |
| - name: Get version from plugin.json | |
| id: get_version | |
| run: | | |
| VERSION=$(jq -r .version plugin.json) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Rename .vcvplugin for platform | |
| run: | | |
| mkdir -p dist-${{ matrix.platform }} | |
| for file in dist/*.vcvplugin; do | |
| if [[ "${{ matrix.platform }}" == "x64" ]]; then | |
| mv "$file" "dist-${{ matrix.platform }}/JW-Modules-${{ steps.get_version.outputs.version }}-mac-x64.vcvplugin" | |
| else | |
| mv "$file" "dist-${{ matrix.platform }}/JW-Modules-${{ steps.get_version.outputs.version }}-mac-arm64.vcvplugin" | |
| fi | |
| done | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: dist-${{ matrix.platform }}/*.vcvplugin | |
| name: mac-${{ matrix.platform }} | |
| overwrite: true | |
| publish: | |
| name: Publish plugin | |
| 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@v1 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| 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 | |
| publish-nightly: | |
| name: Publish nightly | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| runs-on: ubuntu-latest | |
| needs: [build, build-mac] | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: _artifacts | |
| - name: Delete old release assets | |
| uses: mknejp/delete-release-assets@v1 | |
| with: | |
| token: ${{ github.token }} | |
| tag: Nightly | |
| fail-if-no-assets: false | |
| assets: '*' | |
| - name: Upload release assets | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: _artifacts/**/*.vcvplugin | |
| tag: Nightly | |
| file_glob: true |