Minecraft-Console-Client/.github/workflows/build-and-release.yml
breadbyte ea6788278d
Fix automated build for .NET releases (#2059)
* Fix automated build for .NET releases
* Update build-and-release.yml
* update submodule for building
* Update build-and-release.yml
* update consoleinteractive build
* Update build-and-release.yml
* set PublishSingleFile as true by default
* update csproj file to include compile flag

setting IncludeNativeLibrariesForSelfExtract to true removes the sni.dll output file.

* update build instructions on README
* move compile flags into env variable

- disable compilation of PDB files
- enable OSX builds
2022-08-15 18:20:25 +02:00

102 lines
3.5 KiB
YAML

name: Build
on:
push:
branches: [ master ]
env:
PROJECT: "MinecraftClient"
target-version: "net6.0"
compile-flags: "--no-self-contained -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Project Path
run: |
echo project-path=${{ github.workspace }}/${{ env.PROJECT }} >> $GITHUB_ENV
- name: Setup Output Paths
run: |
echo win-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-x64/publish/ >> $GITHUB_ENV
echo linux-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-x64/publish/ >> $GITHUB_ENV
echo osx-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/osx-x64/publish/ >> $GITHUB_ENV
- name: Setup .NET SDK
uses: actions/setup-dotnet@v2.1.0
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'true'
- name: Get Version DateTime
id: date-version
uses: nanzm/get-time-action@v1.0
with:
timeZone: 0
format: 'YYYY-MM-DD'
- name: VersionInfo
run: |
COMMIT=$(echo ${{ github.sha }} | cut -c 1-7)
echo '' >> ${{ env.project-path }}\Properties\AssemblyInfo.cs
echo "[assembly: AssemblyConfiguration(\"GitHub build ${{ github.run_number }}, built on ${{ steps.date-version.outputs.time }} from commit $COMMIT\")]" >> ${{ env.project-path }}\Properties\AssemblyInfo.cs
- name: Build for Windows
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-x64 ${{ env.compile-flags }}
- name: Zip Windows Build
run: zip -qq -r windows.zip *
working-directory: ${{ env.win-out-path }}
- name: Build for Linux
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-x64 ${{ env.compile-flags }}
- name: Zip Linux Build
run: zip -qq -r linux.zip *
working-directory: ${{ env.linux-out-path }}
- name: Build for OSX
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r osx-x64 ${{ env.compile-flags }}
- name: Zip OSX Build
run: zip -qq -r osx.zip *
working-directory: ${{ env.osx-out-path }}
- name: Get Release DateTime
id: date-release
uses: nanzm/get-time-action@v1.0
with:
timeZone: 0
format: 'YYYYMMDD'
- name: Windows Release
uses: tix-factory/release-manager@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
mode: uploadReleaseAsset
filePath: ${{ env.win-out-path }}windows.zip
assetName: ${{ env.PROJECT }}-windows.zip
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
- name: Linux Release
uses: tix-factory/release-manager@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
mode: uploadReleaseAsset
filePath: ${{ env.linux-out-path }}linux.zip
assetName: ${{ env.PROJECT }}-linux.zip
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
- name: OSX Release
uses: tix-factory/release-manager@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
mode: uploadReleaseAsset
filePath: ${{ env.osx-out-path }}osx.zip
assetName: ${{ env.PROJECT }}-osx.zip
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}