-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
237 lines (214 loc) · 8.29 KB
/
release.yml
File metadata and controls
237 lines (214 loc) · 8.29 KB
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
on:
workflow_dispatch:
inputs:
platform-linux:
description: Include Linux
default: false
type: boolean
platform-android:
description: Include Android
default: false
type: boolean
platform-ios:
description: Include iOS
default: false
type: boolean
sign:
description: Code sign packages
default: true
type: boolean
build-prerequisites-installer:
description: Build prerequisites installer
default: true
type: boolean
deploy:
description: Deploy to NuGet.org and create GitHub Release
default: false
type: boolean
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
#
# Validate inputs and permissions
#
Validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Check deploy requires signing
if: ${{ inputs.deploy && !inputs.sign }}
run: |
echo "::error::Cannot deploy unsigned packages. Enable 'sign' to deploy."
exit 1
- name: Check release permissions
if: ${{ inputs.sign || inputs.deploy }}
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
ORG=$(echo "${{ github.repository }}" | cut -d/ -f1)
TEAM="stride-release-managers"
USER="${{ github.actor }}"
STATUS=$(gh api "orgs/$ORG/teams/$TEAM/memberships/$USER" --silent 2>&1 && echo "ok" || echo "fail")
if [ "$STATUS" = "fail" ]; then
echo "::error::User $USER is not a member of $ORG/$TEAM. Sign/deploy requires stride-release-managers team membership."
exit 1
fi
#
# Build and package
#
Package:
name: Package
needs: Validate
runs-on: windows-2025-vs2026
environment: production
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0 # Full history needed for GitVersioning
- uses: actions/setup-dotnet@v4
with:
# 6.0.x required by deps/Gettext.Net/GNU.Gettext.Msgfmt.exe (see #3113)
dotnet-version: |
6.0.x
10.0.x
- uses: microsoft/setup-msbuild@v2
- name: Install Advanced Installer
if: ${{ inputs.build-prerequisites-installer }}
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://www.advancedinstaller.com/downloads/22.0/advinst.msi" -OutFile advinst.msi
msiexec /i advinst.msi /qn ADDLOCAL=ALL | Out-Null
# Register license if provided
if ("${{ secrets.ADVINST_LICENSE_KEY }}" -ne "") {
& "${env:ProgramFiles(x86)}\Caphyon\Advanced Installer 22.0\bin\x86\AdvancedInstaller.com" /register "${{ secrets.ADVINST_LICENSE_KEY }}"
}
- name: Build Package
run: |
$platforms = "Windows"
if ("${{ inputs.platform-linux }}" -eq "true") { $platforms += ";Linux" }
if ("${{ inputs.platform-android }}" -eq "true") { $platforms += ";Android" }
if ("${{ inputs.platform-ios }}" -eq "true") { $platforms += ";iOS" }
echo "Building for platforms: $platforms"
msbuild build\Stride.build `
/t:Package `
/bl /m /nr:false `
/p:StridePlatforms="$platforms" `
/p:StrideGraphicsApiDependentBuildAll=true `
/p:StrideSign=${{ inputs.sign }} `
/p:StrideBuildPrerequisitesInstaller=${{ inputs.build-prerequisites-installer }} `
/p:StrideNativeBuildMode=Clang
env:
StrideDisableAssetCompilerExecServerProxy: true
StrideSignTenantId: ${{ inputs.sign && secrets.STRIDE_SIGN_TENANT_ID || '' }}
StrideSignClientId: ${{ inputs.sign && secrets.STRIDE_SIGN_CLIENT_ID || '' }}
StrideSignClientSecret: ${{ inputs.sign && secrets.STRIDE_SIGN_CLIENT_SECRET || '' }}
StrideSignKeyVaultCertificate: ${{ inputs.sign && secrets.STRIDE_SIGN_KEYVAULT_CERTIFICATE || '' }}
StrideSignKeyVaultName: ${{ inputs.sign && secrets.STRIDE_SIGN_KEYVAULT_NAME || '' }}
- name: Detect version
id: version
shell: pwsh
run: |
$pkg = Get-ChildItem -Path bin/packages -Filter "Stride.Core.*.nupkg" | Select-Object -First 1
if ($pkg) {
$version = $pkg.Name -replace 'Stride\.Core\.(.*?)\.nupkg','$1'
echo "version=$version" >> $env:GITHUB_OUTPUT
echo "::notice::Package version: $version"
} else {
echo "::error::No Stride.Core package found"
exit 1
}
- name: Upload NuGet packages
uses: actions/upload-artifact@v4
with:
name: packages
path: bin/packages/*.nupkg
if-no-files-found: error
- name: Upload build log
uses: actions/upload-artifact@v4
if: ${{ always() && !inputs.sign }}
with:
name: build-log
path: msbuild.binlog
if-no-files-found: ignore
#
# Deploy to NuGet.org and create GitHub Release
#
Deploy:
name: Deploy ${{ needs.Package.outputs.version }}
if: ${{ inputs.deploy && inputs.sign }}
needs: Package
runs-on: ubuntu-latest # NuGet push doesn't need Windows
environment: production # Requires manual approval in GitHub settings
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Download packages
uses: actions/download-artifact@v4
with:
name: packages
path: bin/packages
- name: List packages
shell: pwsh
run: |
echo "## Packages to deploy" >> $env:GITHUB_STEP_SUMMARY
echo '```' >> $env:GITHUB_STEP_SUMMARY
Get-ChildItem -Path bin -Recurse -Filter "*.nupkg" | ForEach-Object {
echo "$($_.Name)" >> $env:GITHUB_STEP_SUMMARY
}
echo '```' >> $env:GITHUB_STEP_SUMMARY
- name: Push NuGet packages
shell: pwsh
run: |
$packages = Get-ChildItem -Path bin/packages -Filter "*.nupkg"
$main = $packages | Where-Object { $_.Name -notmatch 'GameStudio' -and $_.Name -notmatch 'Samples\.Templates' }
$samples = $packages | Where-Object { $_.Name -match 'Samples\.Templates' }
$gameStudio = $packages | Where-Object { $_.Name -match 'GameStudio' }
echo "::group::Pushing main packages ($($main.Count))"
foreach ($pkg in $main) {
echo "Pushing $($pkg.Name)..."
dotnet nuget push $pkg.FullName --api-key $env:STRIDE_NUGET_API_KEY --source "https://api.nuget.org/v3/index.json" --timeout 1800 --skip-duplicate
}
echo "::endgroup::"
if ($samples) {
echo "::group::Pushing Samples.Templates"
foreach ($pkg in $samples) {
dotnet nuget push $pkg.FullName --api-key $env:STRIDE_NUGET_API_KEY --source "https://api.nuget.org/v3/index.json" --timeout 1800 --skip-duplicate
}
echo "::endgroup::"
}
if ($gameStudio) {
echo "::group::Pushing GameStudio (last, so dependencies are already available)"
foreach ($pkg in $gameStudio) {
dotnet nuget push $pkg.FullName --api-key $env:STRIDE_NUGET_API_KEY --source "https://api.nuget.org/v3/index.json" --timeout 1800
}
echo "::endgroup::"
}
env:
STRIDE_NUGET_API_KEY: ${{ secrets.STRIDE_NUGET_API_KEY }}
- name: Tag release
run: |
if git rev-parse "releases/${{ needs.Package.outputs.version }}" >/dev/null 2>&1; then
echo "Tag releases/${{ needs.Package.outputs.version }} already exists, skipping"
else
git tag "releases/${{ needs.Package.outputs.version }}"
git push origin "releases/${{ needs.Package.outputs.version }}"
fi
- name: Create GitHub Release
run: |
gh release create "releases/${{ needs.Package.outputs.version }}" \
--title "Stride ${{ needs.Package.outputs.version }}" \
--generate-notes \
bin/packages/*.nupkg
env:
GH_TOKEN: ${{ secrets.GH_PAT }}