-
-
Notifications
You must be signed in to change notification settings - Fork 6
154 lines (144 loc) · 5.91 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: MSBuild
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
env:
BUILD_CONFIGURATION: ${{ github.workspace }}/out/build/x64-release
INSTALL_CONFIGURATION: ${{ github.workspace }}/out/install
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: Setup ScriptHook SDK
if: false
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 VS environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Setup CMake Project (Release x64)
run: cmake --preset x64-release
- name: Build CMake Project (Release x64)
run: cmake --build ${{ env.BUILD_CONFIGURATION }}
- name: Install CMake Project (Release x64)
run: cmake --install ${{ env.BUILD_CONFIGURATION }}
- name: Bundle loaders and data files
working-directory: ${{ env.INSTALL_CONFIGURATION }}
run: |
Rename-Item x64-release x64
$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"
# curl -fLJO https://github.com/illusion0001/ScriptHook-Mirrors/releases/download/mirrors/$ScriptHookZip
curl -fLJO $ASIDownloadLink/$ASI_x64
# curl -fLJO $ASIDownloadLink/$ASI_win32
# 7z x $ScriptHookZip
7z x $ASI_x64 -o"x64/!ASI_Loader_x64"
# Copy-Item bin/ScriptHookRDR2.dll ./x64/RDR3.Patches/
# Copy config files
Copy-Item -Recurse -Force ${{ github.workspace }}/data/*/ ./
- name: Clean output folder
run: Remove-Item -Path ${{ env.INSTALL_CONFIGURATION }} -Recurse -Include *.lib
- name: Generate Hash file
working-directory: ${{ env.INSTALL_CONFIGURATION }}/x64
run: |
$asiFiles = Get-ChildItem -Path "." -Filter "*.asi" -Recurse
foreach ($file in $asiFiles)
{
$hash = Get-FileHash -Path "$file" -Algorithm SHA256 | Format-List
$hash | Out-File -Append -FilePath "${{ env.INSTALL_CONFIGURATION }}\hashes.txt"
echo $hash
}
- name: Upload artifact
if: github.event_name != 'workflow_dispatch'
uses: actions/upload-artifact@main
with:
name: ${{ env.zip_name }}-x64-pdb
path: |
${{ env.INSTALL_CONFIGURATION }}/x64
${{ env.INSTALL_CONFIGURATION }}/hashes.txt
- name: Upload artifact (PDB)
if: github.event_name != 'workflow_dispatch'
uses: actions/upload-artifact@main
with:
name: ${{ env.zip_name }}-x64
path: |
${{ env.INSTALL_CONFIGURATION }}/x64
!${{ env.INSTALL_CONFIGURATION }}/x64/**/*.pdb
${{ env.INSTALL_CONFIGURATION }}\hashes.txt
- name: Prepare Release
if: github.event_name == 'workflow_dispatch'
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.INSTALL_CONFIGURATION }}\hashes.txt" | Out-String)
$hashMarkdown | Out-File -FilePath hash.md
Get-Content hash.md
$compress = @{
Path = "${{ env.INSTALL_CONFIGURATION }}\x64", "${{ env.INSTALL_CONFIGURATION }}\hashes.txt"
DestinationPath = "${{ env.zip_name }}-x64-pdb.zip"
}
Compress-Archive @compress
Remove-Item -Path ${{ env.INSTALL_CONFIGURATION }} -Recurse -Include *.pdb
$compress = @{
Path = "${{ env.INSTALL_CONFIGURATION }}\x64", "${{ env.INSTALL_CONFIGURATION }}\hashes.txt"
DestinationPath = "${{ env.zip_name }}-x64.zip"
}
Compress-Archive @compress
- name: Branch Check
if: github.event_name == 'workflow_dispatch'
run: |
$prerelease = ""
if ("${{ env.BRANCH }}" -ieq "main")
{
$prerelease = ""
echo "Is main release"
}
else
{
$prerelease = " --prerelease"
echo "Is not main release: ${{ env.BRANCH }}"
}
echo "prerelease=$prerelease" >> $Env:GITHUB_ENV
- name: Create Release
if: github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: '& gh release create ${{ env.commit_ver }} ${{ env.zip_name }}-x64-pdb.zip ${{ env.zip_name }}-x64.zip --target ${{ GITHUB.SHA }} -t "${{ env.commit_ver }}" -F hash.md${{ env.prerelease }}'