-
Notifications
You must be signed in to change notification settings - Fork 0
237 lines (191 loc) · 7.08 KB
/
release-vst.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
name: Release Juicy Noise VST
on:
push:
tags:
- '*'
branches:
- 'main'
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [
ubuntu-latest,
windows-2019
]
runs-on: ${{ matrix.os }}
env:
BUILDER_IMAGE_UBUNTU: ghcr.io/danand/docker-juce-build-linux/juce-build-linux:0.1.1
BUILDER_IMAGE_FILE_UBUNTU: juce-build-linux.tar
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Format ref
id: format-ref
shell: bash
run: |
sha_short="$(echo "${{ github.sha }}" | head -c 8)"
ref="${sha_short}"
if ${{ startsWith(github.ref, 'refs/tags/') }}; then
ref="${{ github.ref_name }}"
fi
echo "::set-output name=value::${ref}"
- name: Restore builder image cache for Linux
if: matrix.os == 'ubuntu-latest'
id: cache-builder-image-ubuntu
uses: actions/cache@v3
with:
path: ${{ env.BUILDER_IMAGE_FILE_UBUNTU }}
key: ${{ env.BUILDER_IMAGE_UBUNTU }}
- name: Pull builder image for Linux
if: |
matrix.os == 'ubuntu-latest' &&
steps.cache-builder-image-ubuntu.outputs.cache-hit != 'true'
shell: bash
run: |
docker login \
--username ${{ github.repository_owner }} \
--password ${{ secrets._GITHUB_PAT }} \
ghcr.io
docker pull ${{ env.BUILDER_IMAGE_UBUNTU }}
docker save \
-o ${{ env.BUILDER_IMAGE_FILE_UBUNTU }} \
${{ env.BUILDER_IMAGE_UBUNTU }}
- name: Load builder image cache for Linux
if: |
matrix.os == 'ubuntu-latest' &&
steps.cache-builder-image-ubuntu.outputs.cache-hit == 'true'
shell: bash
run: |
docker load -i ${{ env.BUILDER_IMAGE_FILE_UBUNTU }}
- name: Restore Projucer cache for Linux
if: matrix.os == 'ubuntu-latest'
id: cache-projucer-ubuntu
uses: actions/cache@v3
with:
path: JUCE/extras/Projucer/Builds/LinuxMakefile/build/
key: Projucer-${{ matrix.os }}-${{ hashFiles('JUCE/extras/Projucer/Source/**') }}
- name: Restore JUCE modules cache for Linux
if: matrix.os == 'ubuntu-latest'
id: cache-juce-modules-ubuntu
uses: actions/cache@v3
with:
path: juicy-noise-fx/Builds/LinuxMakefile/build/intermediate/**/include_*
key: JUCE-modules-${{ matrix.os }}-${{ hashFiles('JUCE/modules/**') }}
- name: Restore Projucer cache for Windows
if: matrix.os == 'windows-2019'
id: cache-projucer-windows
uses: actions/cache@v3
with:
path: JUCE\extras\Projucer\Builds\VisualStudio2019
key: Projucer-${{ matrix.os }}-${{ hashFiles('JUCE\extras\Projucer\Source\**') }}
- name: Restore JUCE modules cache for Windows
if: matrix.os == 'windows-2019'
id: cache-juce-modules-windows
uses: actions/cache@v3
with:
path: 'juicy-noise-fx\Builds\VisualStudio2019\**\Shared Code\include_*'
key: JUCE-modules-${{ matrix.os }}-${{ hashFiles('JUCE\modules\**') }}
- name: Touch restored cache
shell: bash
run: |
if [ -d "JUCE/extras/Projucer/Builds" ]; then
find "JUCE/extras/Projucer/Builds" -type f | while read -r file; do touch "${file}"; done
fi
if [ -d "juicy-noise-fx/Builds" ]; then
find "juicy-noise-fx/Builds" -type f | while read -r file; do touch "${file}"; done
fi
- name: Build for Linux
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
project_root="juicy-noise-fx"
jucer_project="juicy-noise-fx.jucer"
juce_repo="JUCE"
outputs_dir="${project_root}/Builds/LinuxMakefile/build"
cwd="$(pwd)"
mkdir -p "${outputs_dir}"
docker run \
--rm \
--user "$(id -u):$(id -g)" \
--mount "type=bind,source=${cwd}/${project_root},target=/project-root" \
--mount "type=bind,source=${cwd}/${juce_repo},target=/JUCE" \
--mount "type=bind,source=${cwd}/${outputs_dir},target=/outputs" \
--env "JUCER_PROJECT=${jucer_project}" \
${{ env.BUILDER_IMAGE_UBUNTU }}
- name: Find MSBuild
if: matrix.os == 'windows-2019'
uses: microsoft/[email protected]
- name: Build for Windows
if: matrix.os == 'windows-2019'
shell: pwsh
run: |
$project_path = "$((Get-Location).Path)\juicy-noise-fx\juicy-noise-fx.jucer"
pushd "JUCE\extras\Projucer\Builds\VisualStudio2019"
msbuild Projucer.sln
$projucer = "$((Get-Location).Path)\x64\Debug\App\Projucer.exe"
$job = Start-Job -ScriptBlock { `
param($executable, $project) `
& $executable "--resave", "${project}" `
} `
-ArgumentList `
"${projucer}", `
"${project_path}"
Start-Sleep -Seconds 20
Receive-Job -Job $job
Remove-Job -Job $job
popd
pushd "juicy-noise-fx\Builds\VisualStudio2019"
msbuild juicy-noise-fx.sln
- name: Pack artifacts for Linux
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
find . -name "juicy-noise-fx.so" \
| while read -r so_file; do
platform="$(basename "$(dirname "${so_file}")")"
archive_name="juicy-noise-fx-${{ steps.format-ref.outputs.value }}-${platform}"
archive_dir="${archive_name}/juicy-noise-fx.vst3/Contents/${platform}"
mkdir -p "${archive_dir}"
cp "${so_file}" "${archive_dir}/"
zip -r "${archive_name}.zip" "${archive_dir}/"
rm -rf "${archive_dir}"
done
- name: Pack artifacts for Windows
if: matrix.os == 'windows-2019'
shell: bash
run: |
vst_name="juicy-noise-fx.vst3"
find . -type f -name "${vst_name}" \
| while read -r vst_file; do
cp "${vst_file}" "${vst_name}"
arch="$(basename "$(realpath "$(dirname "${vst_file}")/../..")")"
archive_name="juicy-noise-fx-${{ steps.format-ref.outputs.value }}-${arch}-windows"
7z a "${archive_name}.zip" "${vst_name}"
done
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: vst
path: juicy-noise-fx-*.zip
if-no-files-found: error
retention-days: 2
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: List artifacts
run: |
echo "Artifacts:"
ls -R
- name: Release
uses: softprops/action-gh-release@v1
with:
token: '${{ secrets._GITHUB_PAT }}'
files: './**/juicy-noise-fx-*.zip'