mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Build and Release with GitHub Actions
Based on research by TheSnoozer (#1267) and Archer57 (#1854), discussed in #1916.
This commit is contained in:
parent
095c9cf137
commit
8e563a42f0
1 changed files with 58 additions and 0 deletions
58
.github/workflows/build-and-release.yml
vendored
Normal file
58
.github/workflows/build-and-release.yml
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
# This workflow will build the project using .NET 4 then publish to GitHub releases
|
||||||
|
# Due to running .NET 4 this workflow needs to run on windows-latest
|
||||||
|
# Changes would need to be made for using .NET 5 and later on linux
|
||||||
|
|
||||||
|
name: BuildAndRelease
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
PROJECT: "HelloWorld"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: SetupMSBuild
|
||||||
|
uses: microsoft/setup-msbuild@v1
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: DateVersion
|
||||||
|
id: date-version
|
||||||
|
uses: nanzm/get-time-action@v1.0
|
||||||
|
with:
|
||||||
|
timeZone: 0
|
||||||
|
format: 'YYYY-MM-DD'
|
||||||
|
|
||||||
|
- name: VersionInfo
|
||||||
|
run: |
|
||||||
|
# PowerShell commands
|
||||||
|
set COMMIT "${{ github.sha }}".substring(0, 7)
|
||||||
|
'' >> ${{ github.workspace }}\${{ env.PROJECT }}\Properties\AssemblyInfo.cs
|
||||||
|
"[assembly: AssemblyConfiguration(`"GitHub build ${{ github.run_number }}, built on ${{ steps.date-version.outputs.time }} from commit $COMMIT`")]" >> ${{ github.workspace }}\${{ env.PROJECT }}\Properties\AssemblyInfo.cs
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: msbuild ${{ github.workspace }}\${{ env.PROJECT }}.sln /t:clean,build /p:Configuration=Release /p:Platform="x86" /p:TargetFrameworkVersion="v4.0" /verbosity:minimal
|
||||||
|
|
||||||
|
- name: DateRelease
|
||||||
|
id: date-release
|
||||||
|
uses: nanzm/get-time-action@v1.0
|
||||||
|
with:
|
||||||
|
timeZone: 0
|
||||||
|
format: 'YYYYMMDD'
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ github.workspace }}\${{env.PROJECT}}\bin\Release\${{ env.PROJECT }}.exe
|
||||||
|
assetName: ${{ env.PROJECT }}.exe
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue