-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (87 loc) · 3.31 KB
/
cmake.yml
File metadata and controls
95 lines (87 loc) · 3.31 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
name: Build NdGameSdk
on:
workflow_dispatch:
inputs:
pre-release:
type: boolean
description: 'Mark release as pre-release.'
concurrency:
group: ${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
build:
runs-on: windows-latest
env:
zip: ${{ github.workspace }}/bin.7z
zip_pdb: ${{ github.workspace }}/bin_pdb.7z
permissions:
contents: write
steps:
- name: Checkout main repository
uses: actions/checkout@main
with:
submodules: recursive
fetch-depth: 0
- name: Setup environment variables (workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
$r = "${{ github.event.inputs.pre-release }}" -ieq "true"
$ret = $r ? " --prerelease" : ""
$rel_title = $r ? " PRE-RELEASE" : ""
echo release_arg="$ret" >> ${{ github.env }}
echo release_title="$rel_title" >> ${{ github.env }}
$content = Get-Content -Raw -Path "cmake.toml"
if ($content -match '\[project\](.*?)\n\s*name\s*=\s*"(.*?)"\s*\n\s*version\s*=\s*"(.*?)"')
{
$projectName = $matches[2]
$version = $matches[3]
echo "projectName: $projectName"
echo "version: $version"
echo "projectName=$projectName" >> ${{ github.env }}
echo "projectVersion=$version" >> ${{ github.env }}
}
else
{
echo "Project section not found"
false
}
- name: Cache
uses: actions/cache@v4
with:
path: build
key: ${{ github.repository_id }}-${{ runner.os }}-${{ runner.arch }}-dep
- name: Configure cmkr
run: cmake -P cmkr.cmake
- name: Configure project
run: cmake --preset vs2022
- name: Build
run: cmake --build build --parallel --config RelWithDebInfo
- name: Pack binary
working-directory: build
run: |
$ASI_x64 = "winmm-x64.zip"
$ASIDownloadLink = "https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest"
$ASIPath = "bin/!ASI_Loader_x64"
curl -fLJO "$ASIDownloadLink/$ASI_x64"
7z x $ASI_x64 -o"$ASIPath"
rm $ASI_x64
7z a -mx9 -mtm- ${{ env.zip_pdb }} bin
Remove-Item -Path bin -Recurse -Include *.lib,*.pdb
7z a -mx9 -mtm- ${{ env.zip }} bin
# Clear it for cache
Remove-Item -Path bin -Recurse
- name: Create Release
if: github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$branch = "${{ github.ref_name }}"
$branch = $branch.replace('/','-')
$_ver = "${{ env.projectVersion }}-$(git rev-list HEAD --count)-$(git rev-parse --short=8 HEAD)+${{ github.run_number }}-$branch"
$zip_name="${{ env.projectName }}-$_ver"
cp "${{ env.zip }}" "$zip_name.7z"
cp "${{ env.zip_pdb }}" "$zip_name-pdb.7z"
gh release create "$_ver" `
"$zip_name.7z" `
"$zip_name-pdb.7z" `
--target ${{ GITHUB.SHA }} -t "${{ env.projectName }} ${{ env.projectVersion }}${{ env.release_title }}"${{ env.release_arg }}