Skip to content

Commit d4ed2fa

Browse files
committed
WIP test
1 parent 9c398dd commit d4ed2fa

1 file changed

Lines changed: 213 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
name: Release
2+
3+
on:
4+
push: #temporary to register in github
5+
workflow_dispatch:
6+
inputs:
7+
platforms:
8+
description: Platforms to build
9+
default: 'Windows'
10+
type: choice
11+
options:
12+
- Windows
13+
- 'Windows;Linux'
14+
- 'Windows;Android'
15+
- 'Windows;iOS'
16+
- 'Windows;Linux;Android;iOS'
17+
sign:
18+
description: Code sign packages
19+
default: false
20+
type: boolean
21+
build-prerequisites-installer:
22+
description: Build prerequisites installer (requires Advanced Installer)
23+
default: false
24+
type: boolean
25+
deploy:
26+
description: Deploy to NuGet.org and create GitHub Release
27+
default: false
28+
type: boolean
29+
30+
concurrency:
31+
group: release-${{ github.ref }}
32+
cancel-in-progress: false
33+
34+
jobs:
35+
#
36+
# Build and package
37+
#
38+
Package:
39+
name: Package (${{ inputs.platforms }})
40+
runs-on: windows-latest
41+
outputs:
42+
version: ${{ steps.version.outputs.version }}
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
lfs: true
47+
fetch-depth: 0 # Full history needed for GitVersioning
48+
49+
- uses: actions/setup-dotnet@v4
50+
with:
51+
dotnet-version: |
52+
6.0.x # Required by deps/Gettext.Net/GNU.Gettext.Msgfmt.exe
53+
10.0.x
54+
55+
- name: Build Package
56+
run: |
57+
dotnet msbuild build\Stride.build `
58+
/t:Package `
59+
/bl /m /nr:false `
60+
/p:StridePlatforms="${{ inputs.platforms }}" `
61+
/p:StrideGraphicsApiDependentBuildAll=true `
62+
/p:StrideSign=${{ inputs.sign }} `
63+
/p:StrideBuildPrerequisitesInstaller=${{ inputs.build-prerequisites-installer }} `
64+
/p:StrideNativeBuildMode=Clang
65+
env:
66+
StrideDisableAssetCompilerExecServerProxy: true
67+
StrideSignTenantId: ${{ inputs.sign && secrets.STRIDE_SIGN_TENANT_ID || '' }}
68+
StrideSignClientId: ${{ inputs.sign && secrets.STRIDE_SIGN_CLIENT_ID || '' }}
69+
StrideSignClientSecret: ${{ inputs.sign && secrets.STRIDE_SIGN_CLIENT_SECRET || '' }}
70+
StrideSignKeyVaultCertificate: ${{ inputs.sign && secrets.STRIDE_SIGN_KEYVAULT_CERTIFICATE || '' }}
71+
StrideSignKeyVaultName: ${{ inputs.sign && secrets.STRIDE_SIGN_KEYVAULT_NAME || '' }}
72+
73+
- name: Detect version
74+
id: version
75+
shell: pwsh
76+
run: |
77+
$pkg = Get-ChildItem -Path bin/packages -Filter "Stride.Core.*.nupkg" | Select-Object -First 1
78+
if ($pkg) {
79+
$version = $pkg.Name -replace 'Stride\.Core\.(.*?)\.nupkg','$1'
80+
echo "version=$version" >> $env:GITHUB_OUTPUT
81+
echo "::notice::Package version: $version"
82+
} else {
83+
echo "::error::No Stride.Core package found"
84+
exit 1
85+
}
86+
87+
- name: Upload NuGet packages
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: packages
91+
path: bin/packages/*.nupkg
92+
if-no-files-found: error
93+
94+
- name: Upload VSIX packages
95+
uses: actions/upload-artifact@v4
96+
if: always()
97+
with:
98+
name: vsix
99+
path: bin/vsix/*.nupkg
100+
if-no-files-found: ignore
101+
102+
- name: Upload build log
103+
uses: actions/upload-artifact@v4
104+
if: ${{ always() && !inputs.sign }}
105+
with:
106+
name: build-log
107+
path: msbuild.binlog
108+
if-no-files-found: ignore
109+
110+
#
111+
# Deploy to NuGet.org and create GitHub Release
112+
#
113+
Deploy:
114+
name: Deploy ${{ needs.Package.outputs.version }}
115+
if: ${{ inputs.deploy }}
116+
needs: Package
117+
runs-on: ubuntu-latest # NuGet push doesn't need Windows
118+
environment: production # Requires manual approval in GitHub settings
119+
permissions:
120+
contents: write
121+
steps:
122+
- uses: actions/checkout@v4
123+
with:
124+
fetch-depth: 0
125+
126+
- uses: actions/setup-dotnet@v4
127+
with:
128+
dotnet-version: '10.0.x'
129+
130+
- name: Download packages
131+
uses: actions/download-artifact@v4
132+
with:
133+
name: packages
134+
path: bin/packages
135+
136+
- name: Download VSIX
137+
uses: actions/download-artifact@v4
138+
with:
139+
name: vsix
140+
path: bin/vsix
141+
continue-on-error: true # VSIX may not exist
142+
143+
- name: List packages
144+
shell: pwsh
145+
run: |
146+
echo "## Packages to deploy" >> $env:GITHUB_STEP_SUMMARY
147+
echo '```' >> $env:GITHUB_STEP_SUMMARY
148+
Get-ChildItem -Path bin -Recurse -Filter "*.nupkg" | ForEach-Object {
149+
echo "$($_.Name)" >> $env:GITHUB_STEP_SUMMARY
150+
}
151+
echo '```' >> $env:GITHUB_STEP_SUMMARY
152+
153+
- name: Push NuGet packages
154+
shell: pwsh
155+
run: |
156+
$packages = Get-ChildItem -Path bin/packages -Filter "*.nupkg"
157+
$main = $packages | Where-Object { $_.Name -notmatch 'GameStudio' -and $_.Name -notmatch 'Samples\.Templates' }
158+
$samples = $packages | Where-Object { $_.Name -match 'Samples\.Templates' }
159+
$gameStudio = $packages | Where-Object { $_.Name -match 'GameStudio' }
160+
161+
echo "::group::Pushing main packages ($($main.Count))"
162+
foreach ($pkg in $main) {
163+
echo "Pushing $($pkg.Name)..."
164+
dotnet nuget push $pkg.FullName --api-key $env:NUGET_API_KEY --source "https://api.nuget.org/v3/index.json" --timeout 1800 --skip-duplicate
165+
}
166+
echo "::endgroup::"
167+
168+
if ($samples) {
169+
echo "::group::Pushing Samples.Templates"
170+
foreach ($pkg in $samples) {
171+
dotnet nuget push $pkg.FullName --api-key $env:NUGET_API_KEY --source "https://api.nuget.org/v3/index.json" --timeout 1800 --skip-duplicate
172+
}
173+
echo "::endgroup::"
174+
}
175+
176+
if ($gameStudio) {
177+
echo "::group::Pushing GameStudio (last, so dependencies are already available)"
178+
foreach ($pkg in $gameStudio) {
179+
dotnet nuget push $pkg.FullName --api-key $env:NUGET_API_KEY --source "https://api.nuget.org/v3/index.json" --timeout 1800
180+
}
181+
echo "::endgroup::"
182+
}
183+
env:
184+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
185+
186+
- name: Push VSIX packages
187+
if: ${{ hashFiles('bin/vsix/*.nupkg') != '' }}
188+
shell: pwsh
189+
run: |
190+
Get-ChildItem -Path bin/vsix -Filter "*.nupkg" | ForEach-Object {
191+
echo "Pushing $($_.Name)..."
192+
dotnet nuget push $_.FullName --api-key $env:NUGET_API_KEY --source "https://api.nuget.org/v3/index.json"
193+
}
194+
env:
195+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
196+
197+
- name: Tag release
198+
run: |
199+
if git rev-parse "releases/${{ needs.Package.outputs.version }}" >/dev/null 2>&1; then
200+
echo "Tag releases/${{ needs.Package.outputs.version }} already exists, skipping"
201+
else
202+
git tag "releases/${{ needs.Package.outputs.version }}"
203+
git push origin "releases/${{ needs.Package.outputs.version }}"
204+
fi
205+
206+
- name: Create GitHub Release
207+
run: |
208+
gh release create "releases/${{ needs.Package.outputs.version }}" \
209+
--title "Stride ${{ needs.Package.outputs.version }}" \
210+
--generate-notes \
211+
bin/packages/*.nupkg
212+
env:
213+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)