Skip to content

Add github actions for automated building #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Build MIR

on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main

jobs:
build-linux:
name: Linux
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Initialize and update git submodules
run: |
git submodule init
git submodule update --remote

- name: Set up .NET SDK 9
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.x'

- name: Build the project
working-directory: ./src/MadnessInteractiveReloaded
run: dotnet publish -p:PublishProfile=Linux_Release_x64

- name: Compress artifacts
working-directory: ./src/MadnessInteractiveReloaded/bin/Release/Linux/net9.0/publish
run: |
zip ../MIR-linux-x64.zip -r *

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: MIR-linux-x64
path: |
./src/MadnessInteractiveReloaded/bin/Release/Linux/net9.0/MIR-linux-x64.zip

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./src/MadnessInteractiveReloaded/bin/Release/Linux/net9.0/MIR-linux-x64.zip

build-windows:
name: Windows
runs-on: windows-latest
steps:
- name: Install 7z
uses: milliewalky/setup-7-zip@v2

- name: Checkout code
uses: actions/checkout@v3

- name: Initialize and update git submodules
run: |
git submodule init
git submodule update --remote

- name: Set up .NET SDK 9
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.x'

- name: Build the project
working-directory: ./src/MadnessInteractiveReloaded
run: dotnet publish -p:PublishProfile=Windows_Release_x64

- name: Compress artifacts
working-directory: ./src/MadnessInteractiveReloaded/bin/Release/Windows/net9.0/publish
run: |
7z a ../MIR-win-x64.zip *

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: MIR-win-x64
path: |
./src/MadnessInteractiveReloaded/bin/Release/Windows/net9.0/MIR-win-x64.zip

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./src/MadnessInteractiveReloaded/bin/Release/Windows/net9.0/MIR-win-x64.zip
11 changes: 8 additions & 3 deletions src/MadnessInteractiveReloaded/MIR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<DebugType>embedded</DebugType>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Platforms>AnyCPU;x64</Platforms>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
Expand All @@ -37,13 +38,17 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup>
<CommandPrefix Condition="'$(OS)' != 'Unix'">.\</CommandPrefix>
<CommandPrefix Condition="'$(OS)' == 'Unix'">./</CommandPrefix>
</PropertyGroup>

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

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

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Debug</Configuration>
<Configuration>Release</Configuration>
<Platform>x64</Platform>
<OutDir>bin\Debug\Windows\net9.0\publish\</OutDir>
<PublishDir>bin\Release\Linux\net9.0\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net9.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
<DefineConstants>DEBUG</DefineConstants>
<DefineConstants>RELEASE</DefineConstants>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>
</Project>