You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.3KB

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