Skip to content

Commit c55209e

Browse files
committed
add github actions for automated building
1 parent 52f6284 commit c55209e

File tree

2 files changed

+99
-3
lines changed

2 files changed

+99
-3
lines changed

.github/workflows/build.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Build MIR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '*'
9+
pull_request:
10+
branches:
11+
- main
12+
- dev
13+
14+
jobs:
15+
build-linux:
16+
name: Linux
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
22+
- name: Initialize and update git submodules
23+
run: |
24+
git submodule init
25+
git submodule update --remote
26+
27+
- name: Set up .NET SDK 9
28+
uses: actions/setup-dotnet@v3
29+
with:
30+
dotnet-version: '9.x'
31+
32+
- name: Build the project
33+
working-directory: ./src/MadnessInteractiveReloaded
34+
run: dotnet build --runtime linux-x64 -c Release --self-contained true
35+
36+
- name: Compress artifacts
37+
working-directory: ./src/MadnessInteractiveReloaded/bin/Release/net9.0/linux-x64
38+
run: |
39+
zip ../MIR-linux-x64.zip -r *
40+
41+
- name: Upload artifact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: MIR-linux-x64.zip
45+
path: |
46+
./src/MadnessInteractiveReloaded/bin/Release/net9.0/MIR-linux-x64.zip
47+
48+
- name: Release
49+
uses: softprops/action-gh-release@v2
50+
if: startsWith(github.ref, 'refs/tags/')
51+
with:
52+
files: ./src/MadnessInteractiveReloaded/bin/Release/net9.0/MIR-linux-x64.zip
53+
54+
build-windows:
55+
name: Windows
56+
runs-on: windows-latest
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v3
60+
61+
- name: Initialize and update git submodules
62+
run: |
63+
git submodule init
64+
git submodule update --remote
65+
66+
- name: Set up .NET SDK 9
67+
uses: actions/setup-dotnet@v3
68+
with:
69+
dotnet-version: '9.x'
70+
71+
- name: Build the project
72+
working-directory: ./src/MadnessInteractiveReloaded
73+
run: dotnet build --runtime win-x64 -c Release
74+
75+
- name: Compress artifacts
76+
working-directory: ./src/MadnessInteractiveReloaded/bin/Release/net9.0/win-x64
77+
run: |
78+
zip ../MIR-win-x64.zip -r *
79+
80+
- name: Upload artifact
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: MIR-win-x64.tar.xz
84+
path: |
85+
./src/MadnessInteractiveReloaded/bin/Release/net9.0/MIR-win-x64.zip
86+
87+
- name: Release
88+
uses: softprops/action-gh-release@v2
89+
if: startsWith(github.ref, 'refs/tags/')
90+
with:
91+
files: ./src/MadnessInteractiveReloaded/bin/Release/net9.0/MIR-win-x64.zip

src/MadnessInteractiveReloaded/MIR.csproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<DebugType>embedded</DebugType>
1616
<GenerateDocumentationFile>True</GenerateDocumentationFile>
1717
<Platforms>AnyCPU;x64</Platforms>
18+
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
1819
</PropertyGroup>
1920

2021
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
@@ -37,13 +38,17 @@
3738
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
3839
<DebugType>portable</DebugType>
3940
</PropertyGroup>
41+
<PropertyGroup>
42+
<CommandPrefix Condition="'$(OS)' != 'Unix'">.\</CommandPrefix>
43+
<CommandPrefix Condition="'$(OS)' == 'Unix'">./</CommandPrefix>
44+
</PropertyGroup>
4045

4146
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
42-
<Exec Command=".\MIR --mode pack --input &quot;$(ProjectDir)base&quot; --output resources/base.waa" WorkingDirectory="$(OutDir)" />
43-
</Target>
47+
<Exec Command="$(CommandPrefix)MIR --mode pack --input &quot;$(ProjectDir)base&quot; --output resources/base.waa" WorkingDirectory="$(OutDir)" />
48+
</Target>
4449

4550
<Target Name="PostPublish" AfterTargets="Publish">
46-
<Exec Command=".\MIR --mode pack --input &quot;$(ProjectDir)base&quot; --output resources/base.waa" WorkingDirectory="$(PublishDir)" />
51+
<Exec Command="$(CommandPrefix)MIR --mode pack --input &quot;$(ProjectDir)base&quot; --output resources/base.waa" WorkingDirectory="$(PublishDir)" />
4752
</Target>
4853

4954
<ItemGroup>

0 commit comments

Comments
 (0)