-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
220 lines (204 loc) · 8.43 KB
/
Copy pathrelease.yml
File metadata and controls
220 lines (204 loc) · 8.43 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
name: Release
on:
workflow_dispatch:
inputs:
platform-linux:
description: Include Linux
default: true
type: boolean
platform-android:
description: Include Android
default: true
type: boolean
platform-ios:
description: Include iOS
default: true
type: boolean
platform-macos:
description: Include macOS
default: true
type: boolean
sign:
description: Code sign packages
default: true
type: boolean
build-prerequisites-installer:
description: Build prerequisites installer
default: true
type: boolean
version-suffix:
description: Prerelease suffix, no leading dash (e.g. "beta" -> 4.4.123-beta). Empty = stable.
default: ''
type: string
deploy:
description: Deploy to NuGet.org and create GitHub Release
default: false
type: boolean
bump-version:
description: After a stable deploy, commit the next Patch to the branch (open next dev version)
default: true
type: boolean
upload-binlog:
description: Capture and upload an MSBuild binlog (parallel/race diagnostics). Ignored on signed builds — a binlog records env vars/task params and would leak signing secrets.
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 + tags needed for tag-based versioning
fetch-tags: true
- 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
- name: Install Apple Workloads
# VS provisions the android workload but not ios/macos.
if: ${{ inputs.platform-ios || inputs.platform-macos }}
uses: ./.github/actions/stride-workload
with:
workloads: ${{ inputs.platform-ios && inputs.platform-macos && 'ios macos' || inputs.platform-ios && 'ios' || 'macos' }}
- 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" }
if ("${{ inputs.platform-macos }}" -eq "true") { $platforms += ";macOS" }
echo "Building for platforms: $platforms"
# --no-restore: Stride.build's targets restore their own solutions (same as the
# previous desktop msbuild invocation, which never passed /restore).
dotnet build build\Stride.build `
-t:Package `
--no-restore `
${{ inputs.upload-binlog && !inputs.sign && '-bl' || '' }} -m -nr:false `
-p:StridePlatforms=$($platforms.Replace(';','%3B')) `
-p:StrideGraphicsApiDependentBuildAll=true `
-p:StrideSign=${{ inputs.sign }} `
-p:StrideVersionSuffix=${{ inputs.version-suffix }} `
-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 (-not $pkg) {
echo "::error::No Stride.Core package found"
exit 1
}
$version = $pkg.Name -replace 'Stride\.Core\.(.*?)\.nupkg','$1'
# Guard against a malformed SharedAssemblyInfo.cs slipping a weird version into the package name.
if ($version -notmatch '^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$') {
echo "::error::Detected package version '$version' is not a valid version - check SharedAssemblyInfo.cs"
exit 1
}
echo "version=$version" >> $env:GITHUB_OUTPUT
echo "::notice::Package version: $version"
# Forget-to-bump guard: the version is the committed value in SharedAssemblyInfo.cs, bumped per release. If it
# wasn't bumped, its releases/<version> tag already exists on the previously-released commit, so fail the
# deploy. Re-running the release on the exact tagged commit (idempotent) is allowed (tag points at HEAD).
- name: Guard against re-publishing an existing version
if: ${{ inputs.deploy }}
run: |
TAG="releases/${{ steps.version.outputs.version }}"
if git rev-parse "$TAG" >/dev/null 2>&1 && [ -z "$(git tag --points-at HEAD --list "$TAG")" ]; then
echo "::error::Version ${{ steps.version.outputs.version }} is already released (tag $TAG on another commit). Bump Patch/NuGetVersionSuffix in SharedAssemblyInfo.cs."
exit 1
fi
- 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.upload-binlog && !inputs.sign }}
with:
name: build-log
path: msbuild.binlog
if-no-files-found: ignore
#
# Surface the package version in the run UI. A job can't reference its own outputs in its
# name, so this lightweight job shows Package's version even when Deploy is skipped.
#
Version:
name: Packaged ${{ needs.Package.outputs.version }}
needs: Package
if: ${{ always() && needs.Package.result == 'success' }}
runs-on: ubuntu-latest
steps:
- run: echo "::notice title=Packaged::${{ needs.Package.outputs.version }}"
#
# Deploy to NuGet.org and create GitHub Release
#
Deploy:
name: Deploy ${{ needs.Package.outputs.version }}
if: ${{ inputs.deploy && inputs.sign }}
needs: Package
permissions:
contents: write
uses: ./.github/workflows/release-deploy.yml
with:
run-id: ${{ github.run_id }}
bump-version: ${{ inputs.bump-version }}
secrets: inherit