gen-rack

Create VCV Rack modules from gen~ exports
Log | Files | Refs | README | LICENSE

build-plugin.yml (3363B)


      1 name: Build VCV Rack Plugin
      2 on:
      3   push:
      4     branches:
      5       - build
      6       - '!dev'
      7   release:
      8     types: [published, edited]
      9 
     10 env:
     11   rack-sdk-version: 1.1.6
     12 
     13 defaults:
     14   run:
     15     shell: bash
     16 
     17 jobs:
     18   build:
     19     name: ${{ matrix.config.name }}
     20     runs-on: ${{ matrix.config.os }}
     21     strategy:
     22       matrix:
     23         config:
     24         - {
     25             name: Linux,
     26             os: ubuntu-latest,
     27             prepare-os: sudo apt install -y libglu-dev
     28           }
     29         - {
     30             name: MacOS,
     31             os: macos-latest,
     32             prepare-os: ""
     33           }
     34         - {
     35             name: Windows,
     36             os: windows-latest,
     37             prepare-os: export CC=gcc
     38           }
     39     steps:
     40       - uses: actions/checkout@v2
     41         with:
     42           submodules: recursive
     43       - name: Get Rack-SDK
     44         run: |
     45           pushd $HOME
     46           curl -o Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}.zip
     47           unzip Rack-SDK.zip
     48       - name: Patch plugin.mk, use 7zip on Windows
     49         if: runner.os == 'Windows'
     50         run: |
     51           sed -i 's/zip -q -9 -r/7z a -tzip -mx=9/' $HOME/Rack-SDK/plugin.mk
     52       - name: Modify plugin version
     53         # only modify plugin version if no tag was created
     54         if: "! startsWith(github.ref, 'refs/tags/v')"
     55         run: |
     56           gitrev=`git rev-parse --short HEAD`
     57           pluginversion=`jq -r '.version' plugin.json`
     58           echo "Set plugin version from $pluginversion to $pluginversion-$gitrev"
     59           cat <<< `jq --arg VERSION "$pluginversion-$gitrev" '.version=$VERSION' plugin.json` > plugin.json
     60       - name: Build plugin
     61         run: |
     62           ${{ matrix.config.prepare-os }}
     63           export RACK_DIR=$HOME/Rack-SDK
     64           make -j dep
     65           make -j dist
     66       - name: Upload artifact
     67         uses: actions/upload-artifact@v2
     68         with:
     69           path: dist
     70           name: ${{ matrix.config.name }}
     71 
     72   publish:
     73     name: Publish plugin
     74     # only create a release if a tag was created that is called e.g. v1.2.3
     75     # see also https://vcvrack.com/manual/Manifest#version
     76     if: startsWith(github.ref, 'refs/tags/v')
     77     runs-on: ubuntu-latest
     78     needs: build
     79     steps:
     80       - uses: actions/checkout@v2
     81       - uses: FranzDiebold/github-env-vars-action@v1.2.1
     82       - name: Check if plugin version matches tag
     83         run: |
     84           pluginversion=`jq -r '.version' plugin.json`
     85           if [ "v$pluginversion" != "${{ env.GITHUB_REF_NAME }}" ]; then
     86             echo "Plugin version from plugin.json 'v$pluginversion' doesn't match with tag version '${{ env.GITHUB_REF_NAME }}'"
     87             exit 1
     88           fi
     89       - name: Create Release
     90         uses: actions/create-release@v1
     91         env:
     92           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     93         with:
     94           tag_name: ${{ github.ref }}
     95           release_name: Release ${{ github.ref }}
     96           body: |
     97             ${{ env.GITHUB_REPOSITORY_NAME }} VCV Rack Plugin ${{ env.GITHUB_REF_NAME }}
     98           draft: false
     99           prerelease: false
    100       - uses: actions/download-artifact@v2
    101         with:
    102           path: _artifacts
    103       - name: Upload release assets
    104         uses: svenstaro/upload-release-action@v2
    105         with:
    106           repo_token: ${{ secrets.GITHUB_TOKEN }}
    107           file: _artifacts/**/*.zip
    108           tag: ${{ github.ref }}
    109           file_glob: true