-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (126 loc) · 4.8 KB
/
build-rml.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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build & Test (ResoniteModLoader)
on:
push:
pull_request:
workflow_call:
inputs:
RELEASE_VERSION:
description: "Release Version"
type: string
required: false
default: ""
RELEASE_NOTES:
description: "Release Notes"
type: string
required: false
default: ""
secrets:
STEAM_USER:
required: true
STEAM_TOKEN:
required: true
env:
ARTIFACT_NAME: "SampleMod"
ASSEMBLY_NAME: "mpmxyz.SampleMod.ResoniteModLoader"
PROJECT_FILE: "SampleModRML.csproj"
ResonitePath: "${{ github.workspace }}/Download/Resonite"
PROJECT_URL: "${{ github.server_url }}/${{ github.repository }}"
PROJECT_PATH: "${{ github.workspace }}/repo"
RELEASE_NOTES: "${{ inputs.RELEASE_NOTES }}"
RELEASE_VERSION: "${{ inputs.RELEASE_VERSION }}"
OUTPUT_FOLDER: "bin/RML/Release/net472"
TEST_PROJECT_FILE: "Test/Test.csproj"
MOD_LOADER_TEST_PROJECT_FILE: "TestRML/TestRML.csproj"
defaults:
run:
working-directory: "./repo"
jobs:
build-ResoniteModLoader:
runs-on: ubuntu-latest
steps:
- name: Ensure working directory exists
run: mkdir -p '${{ env.PROJECT_PATH }}'
working-directory: "${{ github.workspace }}"
- name: Get Resonite Infos
run: |
{
echo "APP_INFO<<EOFEOF"
curl https://api.steamcmd.net/v1/info/2519830
echo ""
echo "EOFEOF"
} >> "$GITHUB_ENV"
- name: Get Resonite from Cache
id: cache-resonite
uses: actions/cache@v3.3.3
with:
path: "${{ env.ResonitePath }}"
key: "${{ fromJson( env.APP_INFO ).data['2519830'].depots.branches.public.buildid }}"
- name: Download Steam
if: steps.cache-resonite.outputs.cache-hit != 'true'
uses: CyberAndrii/setup-steamcmd@b786e0da44db3d817e66fa3910a9560cb28c9323
- name: Download Resonite
if: steps.cache-resonite.outputs.cache-hit != 'true'
run: |
steamcmd '+@sSteamCmdForcePlatformType windows' '+force_install_dir "${{ env.ResonitePath }}"' '+login "${{ secrets.STEAM_USER }}" "${{ secrets.STEAM_TOKEN }}"' '+app_license_request 2519830' '+app_update 2519830 validate' '+quit'
#The following line makes the cache much much smaller:
rm -r '${{ env.ResonitePath }}/RuntimeData/PreCache'
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Fetch repository
uses: actions/checkout@v4
with:
path: ${{ env.PROJECT_PATH }}
- name: Fetch latest ResoniteModLoader
uses: robinraju/release-downloader@efa4cd07bd0195e6cc65e9e30c251b49ce4d3e51
with:
repository: resonite-modding-group/ResoniteModLoader
latest: true
fileName: "*.dll"
out-file-path: RML/
- name: Move ResoniteModLoader files
run: |
mkdir -p "$ResonitePath/rml_mods"
mkdir -p "$ResonitePath/rml_libs"
mkdir -p "$ResonitePath/Libraries"
mv ${{ github.workspace }}/RML/0Harmony.dll "$ResonitePath/rml_libs/0Harmony.dll"
mv ${{ github.workspace }}/RML/ResoniteModLoader.dll "$ResonitePath/Libraries/ResoniteModLoader.dll"
- name: Restore dependencies
run: |
dotnet restore "${{ env.PROJECT_FILE }}"
dotnet restore "${{ env.TEST_PROJECT_FILE }}"
dotnet restore "${{ env.MOD_LOADER_TEST_PROJECT_FILE }}"
env:
ASSEMBLY_NAME: ""
- name: Check formatting
run: |
dotnet format --no-restore --verify-no-changes "${{ env.PROJECT_FILE }}"
dotnet format --no-restore --verify-no-changes "${{ env.TEST_PROJECT_FILE }}"
dotnet format --no-restore --verify-no-changes "${{ env.MOD_LOADER_TEST_PROJECT_FILE }}"
env:
ASSEMBLY_NAME: ""
- name: Test
run: |
dotnet test --no-restore --configuration "Release" "${{ env.TEST_PROJECT_FILE }}"
dotnet test --no-restore --configuration "Release" "${{ env.MOD_LOADER_TEST_PROJECT_FILE }}"
env:
ASSEMBLY_NAME: ""
- name: Build
run: |
dotnet build --no-restore --configuration "Release" "${{ env.PROJECT_FILE }}"
cd "${{ env.OUTPUT_FOLDER }}"
mkdir -p "archive/rml_mods"
cp "${{ env.ASSEMBLY_NAME }}.dll" "archive/rml_mods/${{ env.ASSEMBLY_NAME }}.dll"
#mkdir -p "archive/rml_libs"
#cp LIB.dll "archive/rml_libs/LIB.dll"
cd archive
zip -r "${{ env.ARTIFACT_NAME }}-ResoniteModLoader.zip" .
- name: Upload build artifacts
if: ${{ inputs.RELEASE_VERSION }}
uses: actions/upload-artifact@v3.1.3
with:
name: "${{ env.ARTIFACT_NAME }}-ResoniteModLoader"
path: "${{ env.PROJECT_PATH }}/${{ env.OUTPUT_FOLDER }}/archive"