DD2: Sharpness Patch #774
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}' |