-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (113 loc) · 3.75 KB
/
build-plugin.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Build VCV Rack Plugin
on: workflow_dispatch
env:
rack-sdk-version: 2.0.3
defaults:
run:
shell: bash
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
name: Linux,
os: ubuntu-20.04,
prepare-os: sudo apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages update,
prepare-os2: sudo apt install -y libglu-dev,
postfix: lin
}
- {
name: MacOS,
os: macos-latest,
prepare-os: "",
prepare-os2: "",
postfix: mac
}
- {
name: Windows,
os: windows-latest,
prepare-os: export CC=gcc,
prepare-os2: "",
postfix: win
}
language: [ 'cpp' ]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Get Rack-SDK
run: |
pushd $HOME
curl -o Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-${{ matrix.config.postfix }}.zip
unzip Rack-SDK.zip
- name: Patch plugin.mk, use 7zip on Windows
if: runner.os == 'Windows'
run: |
sed -i 's/zip -q -9 -r/7z a -tzip -mx=9/' $HOME/Rack-SDK/plugin.mk
- 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: Initialize CodeQL
if: runner.os == 'Linux'
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Build plugin
run: |
${{ matrix.config.prepare-os }}
${{ matrix.config.prepare-os2 }}
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: Perform CodeQL Analysis
if: runner.os == 'Linux'
uses: github/codeql-action/analyze@v2
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
steps:
- uses: actions/checkout@v2
- uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: Get Release name from plugin and git revision
run: |
pluginversion=`jq -r '.version' plugin.json`
gitrev=`git rev-parse --short HEAD`
echo "releasename=$pluginversion-$gitrev" >> $GITHUB_ENV
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.releasename }}
release_name: Release ${{ env.releasename }}
body: |
${{ env.GITHUB_REPOSITORY_NAME }} VCV Rack Plugin ${{ env.releasename }}
draft: false
prerelease: true
- uses: actions/download-artifact@v2
with:
path: _artifacts
- name: Upload release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: _artifacts/**/*.vcvplugin
tag: ${{ env.releasename }}
file_glob: true