-
Notifications
You must be signed in to change notification settings - Fork 1
336 lines (285 loc) · 10.3 KB
/
release.yaml
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
name: "📦 Release"
on:
# Make a release whenever the developer wants.
workflow_dispatch:
inputs:
bump:
type: choice
description: "version bump method: major, minor, or patch"
required: true
default: "patch"
options:
- major
- minor
- patch
jobs:
build-macos:
runs-on: macos-latest
env:
MAC_APP_DISTRIBUTION_BASE64: ${{ secrets.MAC_APP_DISTRIBUTION }}
KEYCHAIN_PASSWORD: 1234
steps:
- name: 🧾 Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: "recursive"
fetch-depth: 0 # So we can get all tags.
- name: 🔑 Setup Codesigning
run: |
# GitHub has a guide for just this.
# https://docs.github.com/en/actions/use-cases-and-examples/deploying/installing-an-apple-certificate-on-macos-runners-for-xcode-development
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/mac_app_distribution.p12
KEYCHAIN_PATH=$RUNNER_TEMP/codesigning.keychain-db
echo -n "$MAC_APP_DISTRIBUTION_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# save keychain path for later steps
echo "KEYCHAIN_PATH=$KEYCHAIN_PATH" >> $GITHUB_ENV
# save certificate for later steps
CERT=$(security find-identity -p codesigning -v $KEYCHAIN_PATH | grep -oE '".*"' | tr -d '"')
echo "Codesigning certificate: $CERT"
echo "CERT=$CERT" >> $GITHUB_ENV
- uses: actions/setup-dotnet@v4
name: 💽 Setup .NET SDK
with:
# Use the .NET SDK from global.json in the root of the repository.
global-json-file: global.json
- name: 🌍 Install dependencies
run: dotnet restore
- name: 📦 Build for macOS
run: |
chmod +x ./build.sh
./build.sh macos
- name: 🔐 Codesign Dylibs
run: |
codesign --sign "$CERT" --options runtime \
addons/platform/builds/macos/Platform.osx.arm64.dylib
codesign --sign "$CERT" --options runtime \
addons/platform/builds/macos/Platform.osx.x64.dylib
- name: 🧐 Verify Codesigning
run: |
codesign --verify --verbose=4 \
addons/platform/builds/macos/Platform.osx.arm64.dylib
codesign --verify --verbose=4 \
addons/platform/builds/macos/Platform.osx.x64.dylib
- name: ⬆️ Upload macOS artifacts
uses: actions/upload-artifact@v4
with:
name: macos-artifacts
path: ./addons/platform/builds/macos
build-windows:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: 🧾 Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_BASIC }}
lfs: true
submodules: "recursive"
fetch-depth: 0 # So we can get all tags.
- uses: actions/setup-dotnet@v4
name: 💽 Setup .NET SDK
with:
# Use the .NET SDK from global.json in the root of the repository.
global-json-file: global.json
- name: 🌍 Install dependencies
run: dotnet restore
- name: 📦 Build for Windows
run: |
chmod +x ./build.sh
./build.sh windows
- name: ⬆️ Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: windows-artifacts
path: ./addons/platform/builds/windows
build-linux:
runs-on: ubuntu-latest
steps:
- name: 🧾 Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: "recursive"
fetch-depth: 0 # So we can get all tags.
- uses: actions/setup-dotnet@v4
name: 💽 Setup .NET SDK
with:
# Use the .NET SDK from global.json in the root of the repository.
global-json-file: global.json
- name: 🌍 Install dependencies
run: dotnet restore
- name: 📦 Build for Linux
run: |
chmod +x ./build.sh
./build.sh linux
- name: ⬆️ Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: linux-artifacts
path: ./addons/platform/builds/linux
# Project is shipped as GDExtension for GDScript users, and also as a nuget
# package for C# scripting users.
build-for-nuget:
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
steps:
- name: 🧾 Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: 'recursive'
fetch-depth: 0 # So we can get all tags.
- name: 🔎 Read Current Project Version
id: current-version
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: "0.0.0-devbuild"
- name: 🖨 Print Current Version
run: |
echo "Current Version: ${{ steps.current-version.outputs.tag }}"
- name: 🧮 Compute Next Version
uses: chickensoft-games/next-godot-csproj-version@v1
id: next-version
with:
project-version: ${{ steps.current-version.outputs.tag }}
godot-version: global.json
bump: ${{ inputs.bump }}
- uses: actions/setup-dotnet@v4
name: 💽 Setup .NET SDK
with:
# Use the .NET SDK from global.json in the root of the repository.
global-json-file: global.json
# Write version to file so .NET will build correct version.
- name: 📝 Write Version to File
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "0.0.0-devbuild"
replace: ${{ steps.next-version.outputs.version }}
regex: false
include: Chickensoft.Platform/Chickensoft.Platform.csproj
- name: 📦 Build
working-directory: Chickensoft.Platform
run: dotnet build -c Release
- name: 🔎 Get Package Path
id: package-path
run: |
package=$(find ./Chickensoft.Platform/nupkg -name "*.nupkg")
echo "package=$package" >> "$GITHUB_OUTPUT"
echo "📦 Found package: $package"
- name: ⬆️ Upload nuget package artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-artifact
path: ${{ steps.package-path.outputs.package }}
consolidate-artifacts:
runs-on: ubuntu-latest
needs:
- build-macos
- build-windows
- build-linux
steps:
- name: 🧾 Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: "recursive"
fetch-depth: 0 # So we can get all tags.
- name: Download macOS artifacts
uses: actions/download-artifact@v4
with:
name: macos-artifacts
path: ./addons/platform/builds/macos
- name: Download Windows artifacts
uses: actions/download-artifact@v4
with:
name: windows-artifacts
path: ./addons/platform/builds/windows
- name: Download Linux artifacts
uses: actions/download-artifact@v4
with:
name: linux-artifacts
path: ./addons/platform/builds/linux
- name: Upload consolidated artifact
uses: actions/upload-artifact@v4
with:
name: platform
path: ./addons/platform
create-release:
runs-on: ubuntu-latest
needs:
- consolidate-artifacts
- build-for-nuget
steps:
- name: 🧾 Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_BASIC }}
lfs: true
submodules: "recursive"
fetch-depth: 0 # So we can get all tags.
- name: 🔎 Read Current Project Version
id: current-version
run: |
echo "tag=$(git tag --sort=v:refname | grep -E '^[^v]' | tail -1)" >> "$GITHUB_OUTPUT"
- name: 🖨 Print Current Version
run: |
echo "Current Version: ${{ steps.current-version.outputs.tag }}"
- name: 🧮 Compute Next Version
uses: chickensoft-games/next-godot-csproj-version@v1
id: next-version
with:
project-version: ${{ steps.current-version.outputs.tag }}
# This action was designed to pin versions to Godot versions, but
# if you pass a stable version in it just bumps the project version
# that you give it.
godot-version: 1.0.0
bump: ${{ inputs.bump }}
- name: Download GDExtension artifacts
uses: actions/download-artifact@v4
with:
name: platform
path: ./platform
- name: Download nuget package artifact
uses: actions/download-artifact@v4
with:
name: nuget-artifact
path: ./nuget
- name: 🔎 Get Nuget Package Path
id: package-path
run: |
package=$(find ./nuget -name "*.nupkg")
echo "package=$package" >> "$GITHUB_OUTPUT"
echo "📦 Found nuget package: $package"
- name: ✨ Create Release
env:
GITHUB_TOKEN: ${{ secrets.GH_BASIC }}
run: |
zip -r ./platform.zip ./platform
version="${{ steps.next-version.outputs.version }}"
NUGET_PKG="${{ steps.package-path.outputs.package }}"
gh release create --title "v$version" --generate-notes "$version" \
./platform.zip "$NUGET_PKG"
- uses: actions/setup-dotnet@v4
name: 💽 Setup .NET SDK
with:
# Use the .NET SDK from global.json in the root of the repository.
global-json-file: global.json
- name: 🛜 Publish Nuget Package
run: |
dotnet nuget push "${{ steps.package-path.outputs.package }}" \
--api-key "${{ secrets.NUGET_API_KEY }}" \
--source "https://api.nuget.org/v3/index.json" --skip-duplicate