-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (67 loc) · 3.59 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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: MSBuild
on:
push:
branches: [ "main" ]
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: ./SaveDataParser.vcxproj
# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release
BUILD_PLATFORM: x64
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Create environment variables
run: |
$commitSha = (git rev-parse --short $env:GITHUB_SHA)
echo "NGPLUS_COMMIT_SHA=${commitSha}" | Out-File -FilePath $env:GITHUB_ENV -Encoding UTF8 -Append
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}}
- name: Prepare ZIP
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
$packagingDir = "./_packaging"
# Create the necessary directories
New-Item -ItemType directory -Path $packagingDir/red4ext
New-Item -ItemType directory -Path $packagingDir/red4ext/plugins
New-Item -ItemType directory -Path $packagingDir/red4ext/plugins/NewGamePlus
New-Item -ItemType directory -Path $packagingDir/red4ext/plugins/NewGamePlus/redscript
# Copy the build artifacts
Copy-Item -Path ./x64/Release/NewGamePlus.dll -Destination $packagingDir/red4ext/plugins/NewGamePlus
Copy-Item -Path ./x64/Release/NewGamePlus.pdb -Destination $packagingDir/red4ext/plugins/NewGamePlus
# Copy over Redscript
Copy-Item -Path ./scripting/* -Destination $packagingDir/red4ext/plugins/NewGamePlus/redscript -Recurse
# Copy over archive and .xl file (TODO: pack .archive dynamically)
Copy-Item -Path ./wolvenkit/packed/archive/pc/mod/NewGamePlus.archive -Destination $packagingDir/red4ext/plugins/NewGamePlus
Copy-Item -Path ./wolvenkit/packed/archive/pc/mod/NewGamePlus.archive.xl -Destination $packagingDir/red4ext/plugins/NewGamePlus
# Copy the license and third-party licenses
Copy-Item -Path ./LICENSE -Destination $packagingDir/red4ext/plugins/NewGamePlus/LICENSE
Copy-Item -Path ./THIRDPARTY_LICENSES -Destination $packagingDir/red4ext/plugins/NewGamePlus/THIRD_PARTY_LICENSES
# DLL hash generation
Get-FileHash -Algorithm SHA256 -Path $packagingDir/red4ext/plugins/NewGamePlus/NewGamePlus.dll | Out-File -FilePath $packagingDir/red4ext/plugins/NewGamePlus/DLLHash.txt -Width 512
Get-FileHash -Algorithm SHA256 -Path $packagingDir/red4ext/plugins/NewGamePlus/NewGamePlus.pdb | Out-File -FilePath $packagingDir/red4ext/plugins/NewGamePlus/PDBHash.txt -Width 512
# Create the ZIP file.
7z a NewGamePlus.zip $packagingDir/*
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: newgameplus_${{ env.NGPLUS_COMMIT_SHA }}
path: _packaging/