installer: add a .NET game installer

This commit is contained in:
rr- 2022-06-07 00:36:56 +02:00 committed by Marcin Kurczewski
parent 1b328bf92a
commit cdd1f50b91
58 changed files with 2384 additions and 31 deletions

View file

@ -22,5 +22,5 @@ jobs:
- name: Build Docker image
run: |
docker build -t "rrdash/tomb1main:latest" . -f docker/Dockerfile
docker build -t "rrdash/tomb1main:latest" . -f docker/game/Dockerfile
docker push "rrdash/tomb1main:latest"

View file

@ -1,4 +1,4 @@
name: Publish new release
name: Publish a new release
on:
push:
@ -31,7 +31,56 @@ on:
jobs:
publish_release:
name: Publish new release
name: Create a GitHub release
runs-on: ubuntu-latest
needs: [build_game, build_installer]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: .
fetch-depth: 0
- name: Download built game asset
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game
- name: Download built installer asset
uses: actions/download-artifact@v1
with:
path: artifacts/
name: installer
- name: Extract tag name
id: get_version
run: echo ::set-output name=VERSION::$(git describe --abbrev=7 --tags)
- name: Rename assets
run: |
mv artifacts/game.zip artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}.zip
mv artifacts/Tomb1Main_Installer.exe artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}-Installer.exe
- name: Generate Changelog
run: python3 -c 'from pathlib import Path; print(Path("CHANGELOG.md").read_text().split("\n\n")[1])' | tail -n -1 > artifacts/changes.txt
- name: Release
uses: softprops/action-gh-release@v1
#if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ github.ref }}
body_path: artifacts/changes.txt
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
fail_on_unmatched_files: true
files: |
artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}.zip
artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}-Installer.exe
build_game:
name: Build the game
runs-on: ubuntu-latest
steps:
- name: Checkout code
@ -40,41 +89,56 @@ jobs:
path: .
fetch-depth: 0
- name: Extract tag name
id: get_version
run: echo ::set-output name=VERSION::$(git describe --abbrev=7 --tags)
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make p7zip-full moby-engine moby-cli
- name: Build project
- name: Build the game
run: |
make clean release
- name: Package release
- name: Package the game
run: |
7z a Tomb1Main-${{ steps.get_version.outputs.VERSION }}.zip ./bin/* ./build/*.exe
7z a game.zip ./bin/* ./build/*.exe
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: ${{ github.event.inputs.draft }}
prerelease: ${{ github.event.inputs.prerelease }}
name: game
path: game.zip
- name: Upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_installer:
name: Build the installer
needs: [build_game]
runs-on: windows-latest # https://github.com/dotnet/runtime/issues/3828
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Tomb1Main-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: Tomb1Main-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
path: .
fetch-depth: 0
- name: Download built assets
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game
- name: Setup dependencies
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0'
- name: Build
run: |
cp artifacts/game.zip tools/installer/Installer/Resources/release.zip
cd tools/installer
dotnet restore
dotnet publish -c Release -o out
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
name: installer
path: tools/installer/out/Tomb1Main_Installer.exe