Skip to content

Commit

Permalink
Workflow and readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhelmut committed Mar 15, 2024
1 parent b78599d commit a30cf74
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and publish to Steam
name: Build

on:
push:
Expand Down Expand Up @@ -31,25 +31,12 @@ jobs:
steps:

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

- name: Restore LFS cache
uses: actions/cache@v3
id: lfs-cache
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1

- name: Pull LFS objects
run: git lfs pull

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

Expand All @@ -59,14 +46,14 @@ jobs:
- name: Restore .NET dependencies
run: dotnet restore

- name: Install Linux dependencies
- name: Install Linux dependencies for PublishAot
run: sudo apt-get update && sudo apt-get install zlib1g-dev
if: env.SCRIPT_OS_NAME == 'Linux'

- name: Build x86_64 binary
run: dotnet publish ./PlaceholderGame/PlaceholderGame.csproj -p:PublishDir=../${{ env.BUILD_FOLDER }} -c ${{ matrix.configuration }} -r ${{ env.SCRIPT_OS_RID }} /p:DebugType=None /p:DebugSymbols=false --self-contained

- name: Build arm64 binary
- name: Build arm64 binary (macOS only)
run: dotnet publish ./PlaceholderGame/PlaceholderGame.csproj -p:PublishDir=../${{ env.BUILD_FOLDER_ARM }} -c ${{ matrix.configuration }} -r ${{ env.SCRIPT_OS_RID_ARM }} /p:DebugType=None /p:DebugSymbols=false --self-contained
if: env.SCRIPT_OS_NAME == 'macOS'

Expand All @@ -85,7 +72,7 @@ jobs:
if: env.SCRIPT_OS_NAME == 'macOS'

- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: '${{ env.SCRIPT_OS_NAME }}'
path: '${{ env.BUILD_FOLDER }}'
Expand Down
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
# PlaceholderGame
A placeholder game for Windows, Linux, and macOS to upload to your Steam depots for whatever reason. This also acts as a cross-platform MonoGame template.

A placeholder game for Windows, Linux, and macOS to upload to your Steam depots for whatever reason.

Made with (MonoGame)[https://monogame.net/] and leveraging .NET 8 ```PublishAot``` feature.

This project also acts as a cross-platform MonoGame template.

# How to use

- Fork the project
- Edit (empty.png)[blob/main/PlaceholderGame/Content/empty.png] to your liking
- Push the changes to Github
- Wait for the (Actions)[actions/] to complete and download the generated artifacts from there
- Upload those builds to Steam

# MonoGame template

This project can be used as a MonoGame template to build cross-platform applications and package them automatically with Github Actions.

Whenever you push commits, Actions will build the game for all operating systems (natively using NativeAOT).

## How does it work?

- The (.csproj)[blob/main/PlaceholderGame/PlaceholderGame.csproj] is configured so that NativeAOT only runs when publishing projects and only on systems it can run (avoid cross-compilation errors)
- A (post-build script)[blob/main/PlaceholderGame/post_build.ps1] is creating the macOS App Bundle
- Github (Actions)[blob/main/.github/workflows/build.yml] is used to build the game and fuse macOS x64 and arm64 binaries into one universal binary supporting both

0 comments on commit a30cf74

Please sign in to comment.