-
Notifications
You must be signed in to change notification settings - Fork 17
188 lines (166 loc) · 5.61 KB
/
Copy pathpackage.yml
File metadata and controls
188 lines (166 loc) · 5.61 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
# Tag release: reusable Build (cmt-workflow artifacts) → Inno Setup (Windows) → zip (macOS) → GitHub Release.
# Local packaging: cmake --preset package-windows && cmake --build --preset inno-installer (see DEVELOPMENT.md, CMakeUserPresets.json).
name: Package
on:
push:
tags:
- 'v*'
permissions:
contents: write
concurrency:
group: package-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build (reusable)
uses: ./.github/workflows/build.yml
secrets: inherit
with:
ref: ${{ github.ref }}
package-windows:
needs: build
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Checkout (resources for installer)
uses: actions/checkout@v6
with:
ref: ${{ github.ref }}
submodules: recursive
- name: Download Windows build artifacts
uses: actions/download-artifact@v5
with:
pattern: build-Windows-*
path: ${{ github.workspace }}/_dl
merge-multiple: false
- name: Layout _build_msvc for installer_script.iss
run: |
set -euo pipefail
for sdk in sdk_r20 sdk_r21 sdk_r23 sdk_r25 sdk_2023 sdk_2024 sdk_2025 sdk_2026; do
mkdir -p "_build_msvc/${sdk}/bin/Release/plugins/mmdtool"
src="_dl/build-Windows-${sdk}"
if [ -d "$src" ]; then
cp -R "$src"/* "_build_msvc/${sdk}/bin/Release/plugins/mmdtool/"
else
echo "Missing artifact: $src" >&2
exit 1
fi
done
- name: Install Inno Setup
run: choco install innosetup -y
- name: Compute version from tag
id: ver
shell: bash
run: |
V="${GITHUB_REF_NAME#v}"
echo "version=$V" >> "$GITHUB_OUTPUT"
- name: Run ISCC
shell: pwsh
run: |
$isccCandidates = @()
$isccCommand = Get-Command ISCC.exe -ErrorAction SilentlyContinue
if ($isccCommand) {
$isccCandidates += $isccCommand.Source
}
if ($env:ProgramFiles) {
$isccCandidates += (Join-Path $env:ProgramFiles 'Inno Setup 6\ISCC.exe')
}
if (${env:ProgramFiles(x86)}) {
$isccCandidates += (Join-Path ${env:ProgramFiles(x86)} 'Inno Setup 6\ISCC.exe')
}
$isccCandidates = $isccCandidates | Where-Object { $_ -and (Test-Path -LiteralPath $_) } | Select-Object -Unique
if (-not $isccCandidates) {
throw "ISCC.exe not found"
}
$iscc = $isccCandidates[0]
$arguments = @(
"/DPluginVersion=${{ steps.ver.outputs.version }}",
"/DSdkBuildDir=_build_msvc",
"/DSdkBinConfig=Release",
"$env:GITHUB_WORKSPACE\setup\Common\installer_script.iss"
)
Write-Host "Using ISCC: $iscc"
$process = Start-Process -FilePath $iscc -ArgumentList $arguments -Wait -NoNewWindow -PassThru
if ($process.ExitCode -ne 0) {
throw "ISCC failed with exit code $($process.ExitCode)"
}
- name: Upload installer artifact
uses: actions/upload-artifact@v7
with:
name: windows-installer
path: setup/Common/Output/*.exe
if-no-files-found: error
package-macos:
needs: build
runs-on: macos-latest
defaults:
run:
shell: bash
steps:
- name: Checkout (res/)
uses: actions/checkout@v6
with:
ref: ${{ github.ref }}
submodules: recursive
- name: Download macOS build artifacts
uses: actions/download-artifact@v8
with:
pattern: build-macOS-*
path: ${{ github.workspace }}/_dl
merge-multiple: false
- name: Zip per-SDK plugin + matching res
run: |
set -euo pipefail
mkdir -p dist
res_for_sdk() {
case "$1" in
sdk_r20|sdk_r21|sdk_r23) echo "R20-S24" ;;
*) echo "S24_up" ;;
esac
}
for sdk in sdk_r20 sdk_r21 sdk_r23 sdk_r25 sdk_2023 sdk_2024 sdk_2025 sdk_2026; do
src="_dl/build-macOS-${sdk}"
if [ ! -d "$src" ]; then echo "Missing $src" >&2; exit 1; fi
res_dir="res/$(res_for_sdk "$sdk")"
rm -rf "pkg/${sdk}"
mkdir -p "pkg/${sdk}/mmdtool"
cp -R "$src"/* "pkg/${sdk}/mmdtool/"
cp -R "$res_dir" "pkg/${sdk}/mmdtool/res"
(cd "pkg/${sdk}" && zip -r "${{ github.workspace }}/dist/MMD_Tool_${sdk}_macOS.zip" mmdtool)
done
- name: Upload macOS zip artifacts
uses: actions/upload-artifact@v7
with:
name: macos-zips
path: dist/*.zip
if-no-files-found: error
release:
needs: [package-windows, package-macos]
runs-on: ubuntu-latest
steps:
- name: Download installer
uses: actions/download-artifact@v8
with:
name: windows-installer
path: ${{ github.workspace }}/assets
- name: Download macOS zips
uses: actions/download-artifact@v8
with:
name: macos-zips
path: ${{ github.workspace }}/assets
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: |
## Changelog
_Add release notes here._
Built from commit `${{ github.sha }}`.
files: |
assets/*.exe
assets/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}