-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (107 loc) · 5.59 KB
/
main.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
name: Build & Release
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events
push:
branches: [ master, test-workflow ]
tags: [ release-v* ]
pull_request:
branches: [ master ]
# will be triggered when undrafting or requesting review
types: [review_requested, ready_for_review]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
# Disable the .NET logo in the console output.
DOTNET_NOLOGO: true
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build.
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending .NET CLI telemetry to Microsoft.
DOTNET_CLI_TELEMETRY_OPTOUT: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Build:
# The type of runner that the job will run on
runs-on: windows-latest
# Grant write permission to create release
permissions:
contents: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repositiory
uses: actions/checkout@v4
- name: Read tag name
uses: olegtarasov/get-tag@v2.1.2
id: tagName
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.3
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.1.1
- name: Download DepotDownloader_2.5.0
uses: i3h/download-release-asset@v1.3.3
with:
owner: SteamRE
repo: DepotDownloader
tag: DepotDownloader_2.5.0
file: depotdownloader-2.5.0.zip
- name: Extract DepotDownloader_2.5.0
uses: ihiroky/extract-action@v1
with:
file_path: depotdownloader-2.5.0.zip
extract_dir: depotdownloader
- name: Download Bannerlord binaries
run: dotnet depotdownloader/DepotDownloader.dll -app 261550 -depot 261551 -username ${{secrets.STEAM_LOGIN}} -password ${{secrets.STEAM_PASSWORD}} -filelist ./.github/resources/FileFilters.regexp -dir BannerlordClient;
- name: Download Bannerlord Dedicated Server binaries
run: dotnet depotdownloader/DepotDownloader.dll -app 1863440 -depot 1863441 -username ${{secrets.STEAM_LOGIN}} -password ${{secrets.STEAM_PASSWORD}} -filelist ./.github/resources/FileFilters.regexp -dir BannerlordServer;
# Build Alliance Common
- name: Restore NuGet packages for Alliance Common
run: nuget restore ./Alliance.Common/Alliance.Common.csproj
- name: Build Alliance Common
run: MSBuild.exe ./Alliance.Common/Alliance.Common.csproj /p:Configuration=Release /p:Platform=x64 /p:BANNERLORD_GAME_DIR="$PWD\BannerlordClient\"
# Build Alliance Client
- name: Restore NuGet packages for Alliance Client
run: nuget restore ./Alliance.Client/Alliance.Client.csproj
- name: Build Alliance Client
run: MSBuild.exe ./Alliance.Client/Alliance.Client.csproj /p:Configuration=Release /p:Platform=x64 /p:BANNERLORD_GAME_DIR="$PWD\BannerlordClient\" /p:BuildProjectReferences=false
# Build Alliance Editor
- name: Restore NuGet packages for Alliance Editor
run: nuget restore ./Alliance.Editor/Alliance.Editor.csproj
- name: Build Alliance Editor
run: MSBuild.exe ./Alliance.Editor/Alliance.Editor.csproj /p:Configuration=Release /p:Platform=x64 /p:BANNERLORD_GAME_DIR="$PWD\BannerlordClient\" /p:BuildProjectReferences=false
# Build Alliance Server
- name: Restore NuGet packages for Alliance Server
run: nuget restore ./Alliance.Server/Alliance.Server.csproj
- name: Build Alliance Server
run: MSBuild.exe ./Alliance.Server/Alliance.Server.csproj /p:Configuration=Release /p:Platform=x64 /p:BANNERLORD_SERVER_DIR="$PWD\BannerlordServer\" /p:BuildProjectReferences=false
# Copy additional files to Alliance Server
- name: Copy Config to Alliance Server
run: Copy-Item Alliance.Server/_Launcher/* -Destination BannerlordServer\Modules\Alliance\
if: contains(github.ref, 'refs/tags/release-')
# Zip the Modules for Release
- name: Zip Alliance Client
run: Compress-Archive -Path "$PWD\BannerlordClient\Modules\Alliance" -DestinationPath "Alliance.zip"
if: contains(github.ref, 'refs/tags/release-')
- name: Zip Alliance Editor
run: Compress-Archive -Path "$PWD\BannerlordClient\Modules\Alliance.Editor" -DestinationPath "Alliance.Editor.zip"
if: contains(github.ref, 'refs/tags/release-')
- name: Zip Alliance Server
run: Compress-Archive -Path "$PWD\BannerlordServer\Modules\Alliance" -DestinationPath "Alliance.Server.zip"
if: contains(github.ref, 'refs/tags/release-')
# Set Release Name
- name: Set Release Name
id: set_release_name
run: |
$tagName = "${{ steps.tagName.outputs.tag }}"
$releaseName = "${{ steps.tagName.outputs.tag }}" -replace 'release-', ''
echo "RELEASE_NAME=$releaseName" >> $env:GITHUB_ENV
# Create new Release
- name: Create a Release
uses: ncipollo/release-action@v1.13.0
if: contains(github.ref, 'refs/tags/release-')
with:
artifacts: Alliance.zip, Alliance.Editor.zip, Alliance.Server.zip
name: "Alliance ${{ env.RELEASE_NAME }}"
tag: ${{ steps.tagName.outputs.tag }}
artifactContentType: application/zip