-
-
Notifications
You must be signed in to change notification settings - Fork 266
211 lines (186 loc) · 7.39 KB
/
workflow.yml
File metadata and controls
211 lines (186 loc) · 7.39 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
name: build
on:
push:
paths-ignore:
- '**.md'
- 'funding.yml'
- '.gitignore'
- '.gitattributes'
- '.github/images'
- '.github/ISSUE_TEMPLATE'
pull_request:
paths-ignore:
- '**.md'
- 'funding.yml'
- '.gitignore'
- '.gitattributes'
- '.github/images'
- '.github/ISSUE_TEMPLATE'
jobs:
build:
strategy:
matrix:
include:
- api: vulkan
configuration: release
- api: vulkan
configuration: debug
- api: d3d12
configuration: release
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Setup MSBuild / Visual Studio Environment
uses: microsoft/setup-msbuild@v1
with:
vs-version: '[17.0,18.0)'
- name: Show MSVC version (for debugging)
shell: cmd
run: |
where msbuild
msbuild /version
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" && cl
- name: Generate project files
shell: cmd
working-directory: ${{ github.workspace }}
env:
API: ${{ matrix.api }}
run: |
set CHOICE=2
if "%API%"=="vulkan" set CHOICE=1
call generate_project_files.bat %CHOICE%
if errorlevel 1 exit /b 1
- name: Verify solution file exists
shell: cmd
working-directory: ${{ github.workspace }}
run: |
if not exist spartan.slnx (
echo Error: spartan.slnx not found!
dir *.sln*
exit /b 1
)
echo Solution file found: spartan.slnx
- name: Build
shell: cmd
working-directory: ${{ github.workspace }}
run: msbuild /p:Platform=x64 /p:Configuration=${{ matrix.configuration }} /p:PlatformToolset=v143 /m spartan.slnx
- name: Create artifacts
if: github.event_name != 'pull_request' && matrix.api == 'vulkan'
shell: cmd
run: |
echo "Creating artifacts for ${{ matrix.api }} - ${{ matrix.configuration }}"
IF "${{ matrix.configuration }}" == "release" (
echo "Creating binaries-only archive for Release..."
build_scripts\7z.exe a -bb1 spartan_vulkan_release.7z .\binaries\7z.exe .\binaries\7z.dll .\binaries\dxcompiler.dll .\binaries\libxess.dll .\binaries\data .\binaries\spartan_${{ matrix.api }}.exe
) ELSE (
echo "Creating binaries-only archive for Debug..."
build_scripts\7z.exe a -bb1 spartan_vulkan_debug.7z .\binaries\7z.exe .\binaries\7z.dll .\binaries\libxess.dll .\binaries\data .\binaries\spartan_${{ matrix.api }}_debug.exe
)
echo "Artifact creation completed for ${{ matrix.api }} - ${{ matrix.configuration }}"
- name: Upload artifact
if: github.event_name != 'pull_request' && matrix.api == 'vulkan'
uses: actions/upload-artifact@v4
with:
name: spartan_vulkan_${{ matrix.configuration == 'Release' && 'release' || 'debug' }}
path: spartan_vulkan_${{ matrix.configuration == 'Release' && 'release' || 'debug' }}.7z
release:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download vulkan release build
uses: actions/download-artifact@v4
with:
name: spartan_vulkan_release
path: .
- name: Download vulkan debug build
uses: actions/download-artifact@v4
with:
name: spartan_vulkan_debug
path: .
- name: Get date and time for versioning
id: get_datetime
run: echo "version=$(date +'%Y.%m.%d.%H.%M')" >> $GITHUB_OUTPUT
- name: Rename release artifact
run: |
mv spartan_vulkan_release.7z spartan_vulkan_release_${{ steps.get_datetime.outputs.version }}.7z
- name: Rename debug artifact
run: |
mv spartan_vulkan_debug.7z spartan_vulkan_debug_${{ steps.get_datetime.outputs.version }}.7z
- name: Generate release notes
id: generate_release_notes
uses: actions/github-script@v7
with:
script: |
// 1. Fetch Releases and Commits
const { data: releases } = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1
});
let commits = [];
const lastRelease = releases[0];
if (lastRelease && lastRelease.tag_name) {
const { data: compareData } = await github.rest.repos.compareCommits({
owner: context.repo.owner,
repo: context.repo.repo,
base: lastRelease.tag_name,
head: context.sha
});
commits = compareData.commits || [];
} else {
const { data: recentCommits } = await github.rest.repos.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 50
});
commits = recentCommits || [];
}
// 2. Format Commits
const commitLines = commits
.filter(commit => !commit.commit.message.startsWith('Merge'))
.map(commit => {
const shortSha = commit.sha.substring(0, 7);
const message = commit.commit.message.split('\n')[0];
const url = commit.html_url;
return `- [\`${shortSha}\`](${url}) ${message}`;
});
// 3. Extract Unique Contributors (Restored this logic)
const authorSet = new Set();
commits.forEach(commit => {
if (commit.author && commit.author.login) {
authorSet.add(commit.author.login);
} else {
authorSet.add(commit.commit.author.name);
}
});
const authors = [...authorSet];
let finalNotes = "";
if (commitLines.length > 0) {
finalNotes += commitLines.join('\n');
// Add Contributors section manually (Required because we are using a custom body)
if (authors.length > 0) {
finalNotes += "\n\n### Contributors\n\n";
finalNotes += authors.map(a => `@${a}`).join(', ');
}
} else {
finalNotes = "- Initial release or no new commits found";
}
// 4. Write Direct to Output
const fs = require('fs');
const delimiter = 'EOF_' + Math.random().toString(36).substr(2, 9);
fs.appendFileSync(process.env.GITHUB_OUTPUT, `notes<<${delimiter}\n${finalNotes}\n${delimiter}\n`);
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_datetime.outputs.version }}
name: "Spartan v${{ steps.get_datetime.outputs.version }}"
body: ${{ steps.generate_release_notes.outputs.notes }}
prerelease: true
files: |
spartan_vulkan_release_${{ steps.get_datetime.outputs.version }}.7z
spartan_vulkan_debug_${{ steps.get_datetime.outputs.version }}.7z