-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (128 loc) · 4.64 KB
/
ci.yml
File metadata and controls
145 lines (128 loc) · 4.64 KB
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
name: CI
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
permissions:
contents: read
env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify Steam credentials
shell: bash
run: |
if [ -z "${{ secrets.STEAMUSER }}" ]; then
echo '::error::Missing secrets.STEAMUSER. Add the Steam username used for SteamCMD downloads.'
exit 1
fi
if [ -z "${{ secrets.STEAMPASS }}" ]; then
echo '::error::Missing secrets.STEAMPASS. Add the Steam password used for SteamCMD downloads.'
exit 1
fi
- name: Setup Resonite environment
id: resonite
uses: resonite-modding-group/setup-resonite-env-action@v0.1.0
with:
steam-user: ${{ secrets.STEAMUSER }}
steam-password: ${{ secrets.STEAMPASS }}
- name: Install ResoniteModLoader binaries
env:
RESONITE_PATH: ${{ steps.resonite.outputs.resonite-path }}
shell: bash
run: |
set -euo pipefail
if [ -z "${RESONITE_PATH:-}" ]; then
echo '::error::Resonite path is empty. Ensure the setup-resonite-env step succeeded and exposed resonite-path.'
exit 1
fi
install -d "$RESONITE_PATH/Libraries" "$RESONITE_PATH/rml_libs"
curl -sSfL -o "$RESONITE_PATH/Libraries/ResoniteModLoader.dll" \
https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/ResoniteModLoader.dll
curl -sSfL -o "$RESONITE_PATH/rml_libs/0Harmony.dll" \
https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/0Harmony.dll
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore
env:
ResoniteAssembliesDir: ${{ steps.resonite.outputs.resonite-path }}
shell: bash
run: |
dotnet restore ReferenceReplacement.sln
- name: Verify formatting
env:
ResoniteAssembliesDir: ${{ steps.resonite.outputs.resonite-path }}
shell: bash
run: |
dotnet format ReferenceReplacement.sln --verify-no-changes --no-restore
- name: Build
env:
ResoniteAssembliesDir: ${{ steps.resonite.outputs.resonite-path }}
shell: bash
run: |
dotnet build ReferenceReplacement.sln --configuration Release --no-restore
- name: Test
env:
ResoniteAssembliesDir: ${{ steps.resonite.outputs.resonite-path }}
shell: bash
run: |
dotnet test ReferenceReplacement.sln --configuration Release --no-build
- name: Prepare release assets
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
set -euo pipefail
artifacts_dir=release-artifacts
mkdir -p "$artifacts_dir"
cp src/ReferenceReplacement/bin/Release/net9.0/ReferenceReplacement.dll "$artifacts_dir/ReferenceReplacement.dll"
if [ -f src/ReferenceReplacement/bin/Release/net9.0/ReferenceReplacement.pdb ]; then
cp src/ReferenceReplacement/bin/Release/net9.0/ReferenceReplacement.pdb "$artifacts_dir/ReferenceReplacement.pdb"
fi
- name: Upload release artifacts
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: reference-replacement
path: release-artifacts
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: reference-replacement
path: release-artifacts
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Reference Replacement ${{ github.ref_name }}
generate_release_notes: true
files: |
release-artifacts/ReferenceReplacement.dll
release-artifacts/ReferenceReplacement.pdb