Skip to content

Commit 526b119

Browse files
authored
Merge branch 'BabylonJS:master' into refactor/sdk-project-style
2 parents 185ec90 + c777e46 commit 526b119

2 files changed

Lines changed: 291 additions & 0 deletions

File tree

.github/workflows/cd.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: CD Release
2+
3+
on:
4+
push:
5+
branches: [master]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
env:
12+
MAX_VERSIONS: '2022 2023 2024 2025 2026'
13+
MAYA_VERSIONS: '2020 2022 2023 2024'
14+
15+
jobs:
16+
build:
17+
name: Build All
18+
runs-on: windows-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup MSBuild
25+
uses: microsoft/setup-msbuild@v2
26+
27+
- name: Setup NuGet
28+
uses: nuget/setup-nuget@v2
29+
with:
30+
nuget-version: '6.x'
31+
32+
- name: Version Update - Max
33+
shell: pwsh
34+
run: |
35+
$content = Get-Content -Path '3ds Max\Max2Babylon\Exporter\BabylonExporter.cs' -Raw
36+
$content = $content -replace 'Custom\.Build\.Version', "${{ github.run_number }}"
37+
Set-Content -Path '3ds Max\Max2Babylon\Exporter\BabylonExporter.cs' -Value $content
38+
39+
- name: Version Update - Maya
40+
shell: pwsh
41+
run: |
42+
$content = Get-Content -Path 'Maya\Exporter\BabylonExporter.cs' -Raw
43+
$content = $content -replace 'Custom\.Build\.Version', "${{ github.run_number }}"
44+
Set-Content -Path 'Maya\Exporter\BabylonExporter.cs' -Value $content
45+
46+
# ── 3ds Max ──
47+
- name: NuGet Restore - Max
48+
run: nuget restore "3ds Max\Max2Babylon.sln"
49+
50+
- name: Build Max
51+
run: msbuild "3ds Max\Max2Babylon.sln" /p:Configuration=Release /p:Platform=x64 /p:PostBuildEvent= /p:PreBuildEvent= /v:minimal
52+
53+
# ── Maya ──
54+
- name: NuGet Restore - Maya
55+
run: nuget restore "Maya\Maya2Babylon.sln"
56+
57+
- name: Build Maya
58+
run: msbuild "Maya\Maya2Babylon.sln" /p:Configuration=Release "/p:Platform=Any CPU" /p:PostBuildEvent= /p:PreBuildEvent= /v:minimal
59+
60+
- name: Copy Maya Templates
61+
shell: pwsh
62+
run: |
63+
foreach ($year in "${{ env.MAYA_VERSIONS }}".Split(' ')) {
64+
$dest = "Maya\bin\Release\$year"
65+
if (Test-Path $dest) {
66+
Copy-Item -Path "Maya\AETemplates\*" -Destination $dest -Force -ErrorAction SilentlyContinue
67+
Copy-Item -Path "Maya\NETemplates\*" -Destination $dest -Force -ErrorAction SilentlyContinue
68+
}
69+
}
70+
71+
# ── Installer ──
72+
- name: NuGet Restore - Installer
73+
run: nuget restore "BabylonJS_Installer\BabylonJS_Installer.sln"
74+
75+
- name: Build Installer
76+
run: msbuild "BabylonJS_Installer\BabylonJS_Installer.sln" /p:Configuration=Release "/p:Platform=Any CPU" /p:PostBuildEvent= /v:minimal
77+
78+
# ── Package release zips ──
79+
- name: Package Artifacts
80+
shell: pwsh
81+
run: |
82+
$staging = "release-staging"
83+
New-Item -ItemType Directory -Path $staging -Force | Out-Null
84+
85+
# Max zips
86+
foreach ($year in "${{ env.MAX_VERSIONS }}".Split(' ')) {
87+
$src = "3ds Max\Max2Babylon\$year\bin\Release"
88+
if (Test-Path $src) {
89+
$tmp = "$staging\tmp\Release"
90+
New-Item -ItemType Directory -Path $tmp -Force | Out-Null
91+
Copy-Item -Path "$src\*.dll" -Destination $tmp -Force
92+
Compress-Archive -Path "$staging\tmp\Release" -DestinationPath "$staging\Max_$year.zip" -Force
93+
Remove-Item -Path "$staging\tmp" -Recurse -Force
94+
}
95+
}
96+
97+
# Maya zips
98+
foreach ($year in "${{ env.MAYA_VERSIONS }}".Split(' ')) {
99+
$src = "Maya\bin\Release\$year"
100+
if (Test-Path $src) {
101+
$tmp = "$staging\tmp"
102+
New-Item -ItemType Directory -Path $tmp -Force | Out-Null
103+
Copy-Item -Path "$src\*.dll" -Destination $tmp -Force
104+
Copy-Item -Path "Maya\AETemplates" -Destination "$tmp\Maya\AETemplates" -Recurse -Force -ErrorAction SilentlyContinue
105+
Copy-Item -Path "Maya\NETemplates" -Destination "$tmp\Maya\NETemplates" -Recurse -Force -ErrorAction SilentlyContinue
106+
Compress-Archive -Path "$tmp\*" -DestinationPath "$staging\Maya_$year.zip" -Force
107+
Remove-Item -Path $tmp -Recurse -Force
108+
}
109+
}
110+
111+
# Installer zip
112+
$installerDir = "BabylonJS_Installer\BabylonJS_Installer\bin\Release"
113+
if (Test-Path $installerDir) {
114+
Compress-Archive -Path "$installerDir\BabylonJS_Exporters.exe","BabylonJS_Installer\README.md" -DestinationPath "$staging\Installer.zip" -Force
115+
}
116+
117+
# Print manifest
118+
Get-ChildItem $staging -Filter *.zip | ForEach-Object {
119+
$hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()
120+
$size = [math]::Round($_.Length / 1KB)
121+
Write-Host "$($_.Name) sha256:$hash ${size} KB"
122+
}
123+
124+
# ── Create Release ──
125+
- name: Generate Release Info
126+
id: release_info
127+
shell: pwsh
128+
run: |
129+
$date = Get-Date -Format "yyyyMMdd"
130+
$patch = "${{ github.run_number }}"
131+
$tag = "v${date}.${patch}"
132+
$title = "CD Release ${date}.${patch}"
133+
134+
# Get commits since last tag
135+
$lastTag = git describe --tags --abbrev=0 2>$null
136+
if ($lastTag) {
137+
$log = git log --pretty=format:"- %s (%h)" "${lastTag}..HEAD" | Out-String
138+
} else {
139+
$log = git log --pretty=format:"- %s (%h)" -20 | Out-String
140+
}
141+
142+
$notes = "## What's Changed`n`n${log}"
143+
144+
# Write outputs
145+
"tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
146+
"title=$title" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
147+
148+
# Write body to a file to preserve multiline
149+
$notes | Out-File -FilePath "release-notes.md" -Encoding utf8
150+
151+
- name: Create Tag
152+
run: |
153+
git tag ${{ steps.release_info.outputs.tag }}
154+
git push origin ${{ steps.release_info.outputs.tag }}
155+
156+
- name: Create GitHub Release and Upload Assets
157+
shell: pwsh
158+
env:
159+
GH_TOKEN: ${{ github.token }}
160+
run: |
161+
$tag = "${{ steps.release_info.outputs.tag }}"
162+
$title = "${{ steps.release_info.outputs.title }}"
163+
$assets = Get-ChildItem "release-staging\*.zip" | ForEach-Object { $_.FullName }
164+
165+
gh release create $tag @assets --title $title --notes-file "release-notes.md" --latest

.github/workflows/ci.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Exporters CI
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
env:
8+
BuildConfiguration: Release
9+
BuildPlatform: Any CPU
10+
MAX_VERSIONS: '2022 2023 2024 2025 2026'
11+
MAYA_VERSIONS: '2020 2022 2023 2024'
12+
13+
jobs:
14+
build-max:
15+
name: Build Max
16+
runs-on: windows-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 1
21+
22+
- name: Setup MSBuild
23+
uses: microsoft/setup-msbuild@v2
24+
25+
- name: Setup NuGet
26+
uses: nuget/setup-nuget@v2
27+
with:
28+
nuget-version: '6.x'
29+
30+
- name: Version Update
31+
shell: pwsh
32+
run: |
33+
$content = Get-Content -Path '3ds Max\Max2Babylon\Exporter\BabylonExporter.cs' -Raw
34+
$content = $content -replace 'Custom\.Build\.Version', "${{ github.run_number }}"
35+
Set-Content -Path '3ds Max\Max2Babylon\Exporter\BabylonExporter.cs' -Value $content
36+
37+
- name: NuGet Restore
38+
run: nuget restore "3ds Max\Max2Babylon.sln"
39+
40+
- name: Build
41+
run: msbuild "3ds Max\Max2Babylon.sln" /p:Configuration=${{ env.BuildConfiguration }} /p:Platform=x64 /p:PostBuildEvent= /p:PreBuildEvent= /v:minimal
42+
43+
- name: Upload Artifacts
44+
uses: actions/upload-artifact@v4
45+
if: always()
46+
with:
47+
name: max-binaries
48+
path: 3ds Max/**/bin/**/*.dll
49+
50+
build-maya:
51+
name: Build Maya
52+
runs-on: windows-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 1
57+
58+
- name: Setup MSBuild
59+
uses: microsoft/setup-msbuild@v2
60+
61+
- name: Setup NuGet
62+
uses: nuget/setup-nuget@v2
63+
with:
64+
nuget-version: '6.x'
65+
66+
- name: Version Update
67+
shell: pwsh
68+
run: |
69+
$content = Get-Content -Path 'Maya\Exporter\BabylonExporter.cs' -Raw
70+
$content = $content -replace 'Custom\.Build\.Version', "${{ github.run_number }}"
71+
Set-Content -Path 'Maya\Exporter\BabylonExporter.cs' -Value $content
72+
73+
- name: NuGet Restore
74+
run: nuget restore "Maya\Maya2Babylon.sln"
75+
76+
- name: Build
77+
run: msbuild "Maya\Maya2Babylon.sln" /p:Configuration=${{ env.BuildConfiguration }} "/p:Platform=${{ env.BuildPlatform }}" /p:PostBuildEvent= /p:PreBuildEvent= /v:minimal
78+
79+
- name: Copy Maya Templates
80+
if: always()
81+
shell: pwsh
82+
run: |
83+
foreach ($year in "${{ env.MAYA_VERSIONS }}".Split(' ')) {
84+
$dest = "${{ github.workspace }}\artifacts\Maya\bin\Release\$year"
85+
New-Item -ItemType Directory -Path $dest -Force | Out-Null
86+
Copy-Item -Path "Maya\AETemplates\**\*.mel" -Destination $dest -Force -ErrorAction SilentlyContinue
87+
Copy-Item -Path "Maya\NETemplates\**\*.xml" -Destination $dest -Force -ErrorAction SilentlyContinue
88+
}
89+
90+
- name: Upload Artifacts
91+
uses: actions/upload-artifact@v4
92+
if: always()
93+
with:
94+
name: maya-binaries
95+
path: |
96+
Maya/**/bin/**/*.dll
97+
artifacts/
98+
99+
build-installer:
100+
name: Build Installer
101+
runs-on: windows-latest
102+
steps:
103+
- uses: actions/checkout@v4
104+
with:
105+
fetch-depth: 1
106+
107+
- name: Setup MSBuild
108+
uses: microsoft/setup-msbuild@v2
109+
110+
- name: Setup NuGet
111+
uses: nuget/setup-nuget@v2
112+
with:
113+
nuget-version: '6.x'
114+
115+
- name: NuGet Restore
116+
run: nuget restore "BabylonJS_Installer\BabylonJS_Installer.sln"
117+
118+
- name: Build
119+
run: msbuild "BabylonJS_Installer\BabylonJS_Installer.sln" /p:Configuration=${{ env.BuildConfiguration }} "/p:Platform=${{ env.BuildPlatform }}" /p:PostBuildEvent= /v:minimal
120+
121+
- name: Upload Artifacts
122+
uses: actions/upload-artifact@v4
123+
if: always()
124+
with:
125+
name: installer-binaries
126+
path: BabylonJS_Installer/Dist/**/*

0 commit comments

Comments
 (0)