-
-
Notifications
You must be signed in to change notification settings - Fork 6
131 lines (121 loc) · 5.26 KB
/
msbuild.yml
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
name: MSBuild
on:
push:
paths-ignore:
- '**/*.md'
- '**/*.txt'
pull_request:
paths-ignore:
- '**/*.md'
- '**/*.txt'
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
env:
BUILD_CONFIGURATION: Release
BRANCH: ${{ github.ref_name }}
permissions:
contents: write
steps:
- name: Checkout main repository
uses: actions/checkout@main
with:
submodules: recursive
fetch-depth: 0
- name: Setup environment variables
run: |
$cmdOutput = Split-Path -Path $pwd -Leaf
$_ver = "1.0.$(git rev-list HEAD --count)-$(git rev-parse --short=8 HEAD)"
echo "commit_ver=$_ver" >> "$Env:GITHUB_ENV"
echo "zip_name=$cmdOutput-$_ver" >> "$Env:GITHUB_ENV"
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@main
- name: Setup ScriptHook SDK
working-directory: source/RDR3.Patches/scripthook_sdk
run: |
$ScriptHookZip = "ScriptHookRDR2_SDK_1.0.1207.73.zip"
# Curl cannot download from this url
# So upload it ourselves
# curl -fLJO http://www.dev-c.com/files/$ScriptHookZip
curl -fLJO https://github.com/illusion0001/ScriptHook-Mirrors/releases/download/mirrors/$ScriptHookZip
7z x $ScriptHookZip -aos
- name: Setup yaml-cpp
working-directory: external/yaml-cpp
run: |
cmake -G "Visual Studio 17 2022" -DYAML_BUILD_SHARED_LIBS=OFF -B build -S .
msbuild /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} /p:Platform=x64 .\build\YAML_CPP.sln
- name: Build x64
run: msbuild /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} /p:Platform=x64 -maxcpucount:1 Windows-Game-Patches-x64.sln
- name: Build Win32
run: msbuild /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} /p:Platform=x86 -maxcpucount:1 Windows-Game-Patches-Win32.sln
- name: Bundle loaders and data files
run: |
$ScriptHookZip = "ScriptHookRDR2_1.0.1491.17.zip"
$ASI_win32 = "Ultimate-ASI-Loader.zip"
$ASI_x64 = "Ultimate-ASI-Loader_x64.zip"
$dataFilesLink = "https://github.com/illusion0001/Windows-Game-Patches/releases/download/data-files"
$ASIDownloadLink = "https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/latest/download"
$Crysis3Remaster_Savefiles = "Crysis3Remastered.Patches.SaveGames.zip"
$FlightSimReplay = "KittyHawk.Patches.Replays.V2.zip"
curl -fLJO https://github.com/illusion0001/ScriptHook-Mirrors/releases/download/mirrors/$ScriptHookZip
curl -fLJO $ASIDownloadLink/$ASI_x64
curl -fLJO $ASIDownloadLink/$ASI_win32
curl -fLJO $dataFilesLink/$Crysis3Remaster_Savefiles
curl -fLJO $dataFilesLink/$FlightSimReplay
7z x $ScriptHookZip
7z x $ASI_x64 -o"${{ env.BUILD_CONFIGURATION }}/x64/!ASI_Loader_x64"
7z x $ASI_win32 -o"${{ env.BUILD_CONFIGURATION }}/Win32/!ASI_Loader_Win32"
7z x $Crysis3Remaster_Savefiles
7z x $FlightSimReplay
Copy-Item bin/ScriptHookRDR2.dll ${{ env.BUILD_CONFIGURATION }}/x64/RDR3.Patches/
Copy-Item -Recurse -Force data/*/ ${{ env.BUILD_CONFIGURATION }}/
Remove-Item -Path ${{ env.BUILD_CONFIGURATION }} -Recurse -Include *.lib
Remove-Item -Path ${{ env.BUILD_CONFIGURATION }} -Recurse -Include *.gitkeep
- name: Generate Hash file
working-directory: ${{ env.BUILD_CONFIGURATION }}
run: |
$asiFiles = Get-ChildItem -Path "." -Filter "*.asi" -Recurse
foreach ($file in $asiFiles) {
$hash = Get-FileHash -Path "$file" -Algorithm SHA512 | Format-List
$hash | Out-File -Append -FilePath "hashes.txt"
echo $hash
}
- name: Upload artifact
if: github.event_name != 'workflow_dispatch'
uses: actions/upload-artifact@main
with:
name: ${{ env.zip_name }}
path: ${{ env.BUILD_CONFIGURATION }}
- name: Create Release
if: github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$hashMarkdown = @'
<details>
<summary>Readme Contents (Click to Expand)</summary>
{0}
</details>
<details>
<summary>ASI Plugin Hashes (Click to Expand)</summary>
```yaml
{1}
```
</details>
'@ -f (Get-Content ".github\README.md" | Out-String), (Get-Content "${{ env.BUILD_CONFIGURATION }}\hashes.txt" | Out-String)
$hashMarkdown | Out-File -FilePath hash.md
Get-Content hash.md
$compress = @{
Path = "${{ env.BUILD_CONFIGURATION }}\*"
DestinationPath = "${{ env.zip_name }}.zip"
}
Compress-Archive @compress
if ("${{ env.BRANCH }}" -ieq "main")
{
gh release create ${{ env.commit_ver }} ${{ env.ZIP_NAME }}.zip --target ${{ GITHUB.SHA }} -t "${{ env.commit_ver }}" -F hash.md
}
else
{
gh release create ${{ env.commit_ver }} ${{ env.ZIP_NAME }}.zip --target ${{ GITHUB.SHA }} -t "${{ env.commit_ver }}" -F hash.md --prerelease
}