-
-
Notifications
You must be signed in to change notification settings - Fork 15
279 lines (229 loc) · 8.71 KB
/
release.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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Release
on:
push:
tags:
- "v*"
jobs:
determine-version:
runs-on: ubuntu-latest
outputs:
semVer: ${{ steps.nbgv.outputs.SemVer2 }}
nugetVer: ${{ steps.nbgv.outputs.NuGetPackageVersion }}
asmVer: ${{ steps.nbgv.outputs.AssemblyFileVersion }}
infoVer: ${{ steps.nbgv.outputs.AssemblyInformationalVersion }}
simpleVer: ${{ steps.nbgv.outputs.SimpleVersion }}
revision: ${{ steps.nbgv.outputs.VersionRevision }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Nerdbank.GitVersioning
id: nbgv
uses: dotnet/[email protected]
build-executable:
needs: [ determine-version ]
runs-on: ubuntu-latest
strategy:
matrix:
rid: [ linux_x64, win_x64, osx_x64, osx_arm64 ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore
run: |
chmod +x build.sh
./build.sh restore
- name: Publish
run: |
./build.sh publish \
--runtime ${{ matrix.rid }} \
--skip restore \
--version ${{ needs.determine-version.outputs.nugetVer }} \
--assembly-version ${{ needs.determine-version.outputs.asmVer }} \
--informational-version ${{ needs.determine-version.outputs.infoVer }}
- if: ${{ matrix.rid == 'linux_x64' }}
name: Download libOpenCvSharpExtern.so
env:
GH_TOKEN: ${{ github.token }}
run: |
PACKAGES_JSON=`dotnet list src/Beutl.Engine/Beutl.Engine.csproj package --framework net8.0 --format json`
#4.9.0.2024
OPENCVSHARP_VERSION=`echo $PACKAGES_JSON | jq -r '.projects[0].frameworks[0].topLevelPackages | map(select(.id == "OpenCvSharp4"))[0].requestedVersion'`
echo $OPENCVSHARP_VERSION
#4.9.0
OPENCV_VERSION=`echo $OPENCVSHARP_VERSION | cut -d '.' -f 1-3`
echo $OPENCV_VERSION
#GitのタグとNuGetのバージョンが違う場合があるので
RELEASES_JSON=`gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/shimat/opencvsharp/releases`
FILTER='map(select(.tag_name | startswith("'$OPENCV_VERSION'")))[0].tag_name'
OPENCVSHARP_TAG=`echo "$RELEASES_JSON" | jq -r "$FILTER"`
#ダウンロード
RELEASE=`gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/indigo-san/opencvsharp-extern-builds/releases/tags/$OPENCVSHARP_TAG`
ASSET_ID=`echo "$RELEASE" | jq '.assets | map(select(.name == "libOpenCvSharpExtern.so"))[0].id'`
cd output/Beutl
gh api -H "Accept: application/octet-stream" -H "X-GitHub-Api-Version: 2022-11-28" /repos/indigo-san/opencvsharp-extern-builds/releases/assets/$ASSET_ID > libOpenCvSharpExtern.so
- name: Zip
run: ./build.sh zip --runtime ${{ matrix.rid }} --skip publish --version ${{ needs.determine-version.outputs.nugetVer }}
- name: Save
uses: actions/upload-artifact@v4
with:
name: beutl-${{ matrix.rid }}-${{ needs.determine-version.outputs.semVer }}
path: ./artifacts/*.zip
build-windows-installer:
needs: [ determine-version, build-executable ]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- uses: actions/download-artifact@v4
with:
name: beutl-win_x64-${{ needs.determine-version.outputs.semVer }}
path: artifacts
- name: Extract zip
run: |
mkdir output/Beutl
cd output/Beutl
7z x ../../artifacts/beutl-win-x64-${{ needs.determine-version.outputs.semVer }}.zip
- name: Build installer
run: ./build.cmd build-installer --skip publish --assembly-version ${{ needs.determine-version.outputs.asmVer }}
- name: Save installer
uses: actions/upload-artifact@v4
with:
name: beutl-setup
path: ./artifacts/beutl-setup.exe
build-debian-package:
needs: [ determine-version, build-executable ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- uses: actions/download-artifact@v4
with:
name: beutl-linux_x64-${{ needs.determine-version.outputs.semVer }}
path: artifacts
- name: Extract zip
run: |
cd packages/ubuntu22.04_amd64/usr
mkdir -p lib/beutl
cd lib/beutl
unzip ${{ github.workspace }}/artifacts/Beutl-linux-x64-${{ needs.determine-version.outputs.semVer }}.zip
- name: Change mode
run: |
cd packages/ubuntu22.04_amd64/usr/lib/beutl
chmod +x Beutl
chmod +x Beutl.ExceptionHandler
chmod +x Beutl.PackageTools
chmod +x Beutl.WaitingDialog
- name: Symbolic Link
run: |
cd packages/ubuntu22.04_amd64
mkdir usr/bin
ln -s /usr/lib/beutl/Beutl usr/bin/beutl
ln -s /usr/lib/beutl/Beutl.PackageTools usr/bin/beutl-pkg
- name: Set Version
run: |
cd packages/ubuntu22.04_amd64/DEBIAN
echo "Version: ${{ needs.determine-version.outputs.simpleVer }}-${{ needs.determine-version.outputs.revision }}ubuntu22.04" >> control
- name: Set Installed-Size
run: |
SizeInKiloBytes=`du -s -k packages/ubuntu22.04_amd64 | awk '{print $1}'`
cd packages/ubuntu22.04_amd64/DEBIAN
echo "Installed-Size: $SizeInKiloBytes" >> control
- name: Build package
run: |
cd packages
fakeroot dpkg-deb --build ubuntu22.04_amd64 .
- name: Save package
uses: actions/upload-artifact@v4
with:
name: ubuntu22.04_amd64
path: ./packages/beutl_${{ needs.determine-version.outputs.simpleVer }}-${{ needs.determine-version.outputs.revision }}ubuntu22.04_amd64.deb
build-app-bundle:
needs: [ determine-version ]
runs-on: macos-latest
strategy:
matrix:
rid: [ osx_x64, osx_arm64 ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore
run: |
chmod +x build.sh
./build.sh Restore
- name: Bundle
run: |
./build.sh bundle-app \
--runtime ${{ matrix.rid }} \
--skip restore \
--version ${{ needs.determine-version.outputs.nugetVer }} \
--assembly-version ${{ needs.determine-version.outputs.asmVer }} \
--informational-version ${{ needs.determine-version.outputs.infoVer }}
- name: Zip
run: |
mkdir -p artifacts
cd output/AppBundle
zip ../../artifacts/Beutl.${{ matrix.rid }}.app.zip -r Beutl.app
- name: Save
uses: actions/upload-artifact@v4
with:
name: Beutl_${{ matrix.rid }}
path: artifacts/Beutl.${{ matrix.rid }}.app.zip
build-nuget:
needs: [ determine-version ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore
run: |
chmod +x build.sh
./build.sh restore
- name: Build & Pack
run: |
./build.sh nuget-pack --skip restore \
--version ${{ needs.determine-version.outputs.nugetVer }} \
--assembly-version ${{ needs.determine-version.outputs.asmVer }} \
--informational-version ${{ needs.determine-version.outputs.infoVer }}
- name: Save
uses: actions/upload-artifact@v4
with:
name: Packages
path: ./artifacts/*.nupkg
create-release:
needs: [ build-executable, build-windows-installer, build-debian-package, build-nuget, build-app-bundle ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Print
run: ls artifacts
- uses: ncipollo/release-action@v1
id: create_release
with:
artifacts: "artifacts/**/*.zip,artifacts/**/*.nupkg,artifacts/**/*.deb,artifacts/beutl-setup/beutl-setup.exe"
draft: true
makeLatest: true
generateReleaseNotes: true