Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 committed Nov 21, 2023
2 parents e4ac31a + 44c8239 commit 6a2a1cc
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest]

name: Build on ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
- name: Add GitHub NuGet source
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/bigbang1112-cz/index.json"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
127 changes: 127 additions & 0 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Publish CLI

on:
release:
types: [published]

env:
PROJECT_NAME: EnvimixForTM2020CLI
ARTIFACT_NAME: artifact

permissions:
contents: write # important for release description edit and asset upload
packages: read

jobs:
prepare-description:
runs-on: ubuntu-latest
name: Set release description

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set release information
run: gh release edit ${{ github.ref_name }} -n "$(echo -e '### *[Release is being automatically created, please wait...](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*\n\n${{ github.event.release.body }}')"

build:
needs: prepare-description

strategy:
matrix:
os: [{ os: windows-latest, runtime: win-x64 }, { os: windows-latest, runtime: win-x86 }, { os: ubuntu-latest, runtime: linux-x64 }]

runs-on: ${{ matrix.os.os }}
name: Publish with ${{ matrix.os.os }} (${{ matrix.os.runtime }})

env:
ZIP_SUFFIX: -${{ matrix.os.runtime }}.${{ github.ref_name }}.zip
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

- name: Add GitHub NuGet source
run: dotnet nuget add source --username USERNAME --password ${{ env.GH_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/bigbang1112-cz/index.json"

- name: Restore dependencies
run: dotnet restore

- name: Publish ${{ matrix.os.runtime }}
run: dotnet publish ${{ env.PROJECT_NAME }}
-c Release
-r ${{ matrix.os.runtime }}
-o build/${{ env.PROJECT_NAME }}-${{ matrix.os.runtime }}
-p:PublishSingleFile=true
-p:EnableCompressionInSingleFile=true
-p:PublishTrimmed=true
-p:TrimMode=partial
--self-contained

- name: Zip to ${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}
uses: thedoctor0/zip-release@main
with:
directory: build
path: ${{ env.PROJECT_NAME }}-${{ matrix.os.runtime }}
filename: ../${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}

- name: Calculate SHA256 (Windows)
if: matrix.os.os == 'windows-latest'
run: |
$hash = Get-FileHash -Path '${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}' -Algorithm SHA256
$hashValue = $hash.Hash.ToLower()
Write-Host $hashValue
$hashValue | Out-File -FilePath "${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}.hash.txt"
- name: Calculate SHA256 (Linux)
if: matrix.os.os == 'ubuntu-latest'
run: |
sha256sum "${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}" | awk '{print $1}' | tee >(cat) > ${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}.hash.txt
- name: Upload ${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }} to this release
run: gh release upload ${{ github.ref_name }} ${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}

- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}.hash.txt
if-no-files-found: error

finalize-description:
needs: build

runs-on: ubuntu-latest
name: Finalize release description

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3

- name: Download a Build Artifact
uses: actions/download-artifact@v2.1.1
with:
name: ${{ env.ARTIFACT_NAME }}

- name: Read hash files
run: |
echo "HashLinuxX64=$(tr -d '\r' < ${{ env.PROJECT_NAME }}-linux-x64.${{ github.ref_name }}.zip.hash.txt)" >> $GITHUB_ENV
echo "HashWinX64=$(tr -d '\r' < ${{ env.PROJECT_NAME }}-win-x64.${{ github.ref_name }}.zip.hash.txt)" >> $GITHUB_ENV
echo "HashWinX86=$(tr -d '\r' < ${{ env.PROJECT_NAME }}-win-x86.${{ github.ref_name }}.zip.hash.txt)" >> $GITHUB_ENV
- name: Set release information
run: gh release edit ${{ github.ref_name }} -n "$(echo -e '${{ github.event.release.body }}\n\n**SHA256 win-x64** `${{ env.HashWinX64 }}`\n**SHA256 win-x86** `${{ env.HashWinX86 }}`\n**SHA256 linux-x64** `${{ env.HashLinuxX64 }}`\n\nAssets were automatically generated using the [publish workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).')"

51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
# EnvimixForTM2020
# Envimix For TM2020 [(online)](https://gbx.bigbang1112.cz/tool/envimix-for-tm2020)

[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/BigBang1112-cz/envimix-for-tm2020?include_prereleases&style=for-the-badge)](https://github.com/BigBang1112-cz/envimix-for-tm2020/releases)
[![GitHub all releases](https://img.shields.io/github/downloads/BigBang1112-cz/envimix-for-tm2020/total?style=for-the-badge)](https://github.com/BigBang1112-cz/envimix-for-tm2020/releases)

Hosted on [Gbx Web Tools](https://github.com/bigbang1112-cz/gbx), lives on [Gbx Tool API](https://github.com/bigbang1112-cz/gbx-tool-api), internally powered by [GBX.NET](https://github.com/BigBang1112/gbx-net).

With this tool, you can generate the same maps but with different TM2020 cars.

This tool supports multiple outputs on a single tool instance.

## Settings

Configuration can be managed on the website in the Config component or inside the `Config` folder.

You can now have multiple configs and change between them.

```yml
MapNameFormat: '$<{0}$>.{1}' # {0} is original map name, {1} is the car's modern name
IncludeCarSport: true
IncludeCarSnow: true
IncludeCharacterPilot: true
GenerateDefaultCarVariant: false # If to also generate the environment's default car variant
```
## CLI build
For 100% offline control, you can use the CLI version. Drag and drop your desired maps onto the EnvimixForTM2020CLI(.exe).
**The installation paths still suggest ManiaPlanet paths, which is an oversight.** This will be possible to control in the future and fixed for this scenario.
### ConsoleOptions.yml
- **NoPause** - If true, All "Press key to continue..." will be skipped.
- **SingleOutput** - If false, dragging multiple files will produce multiple results. If true, multiple files will produce only one result.
- **CustomConfig** - Name of the config inside the `Config` folder without the extension.
- **OutputDir** - Forced output directory of produced results.

### Update notifications

The tool notifies you about new versions after launching it. You can press U to directly open the web page where you can download the new version. Auto-updater might come in the future.

### Specific command line arguments

- `-nopause`
- `-config [ConfigName]`
- `-o [OutputDir]` or `-output [OutputDir]`
- `-c:[AnySettingName] [value]` - Force setting through the command line, **currently works only for string values.**

<h2 align="center">#20yearsoftrackmania</h2>

0 comments on commit 6a2a1cc

Please sign in to comment.