Update BUILD.ps1

This commit is contained in:
ChsBuffer
2021-03-31 18:45:21 +08:00
parent a33c2c3757
commit 7ab89b67c5
4 changed files with 38 additions and 22 deletions

View File

@@ -8,6 +8,8 @@ jobs:
build:
name: Build
runs-on: windows-latest
env:
OutputPath: Netch\bin\Publish\Debug
steps:
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2
@@ -19,7 +21,7 @@ jobs:
- name: Build Solution
shell: pwsh
run: .\BUILD.ps1
run: .\BUILD.ps1 Debug -o ${{ env.OutputPath }}
- name: Upload Artifact
continue-on-error: true
@@ -27,4 +29,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: Netch
path: Netch\bin\x64\Release
path: ${{ env.OutputPath }}

View File

@@ -18,7 +18,7 @@ jobs:
- name: Build Solution
shell: pwsh
run: .\PUBLISH.ps1
run: .\BUILD.ps1
- name: Package
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}

View File

@@ -1,8 +1,38 @@
Write-Host 'Building'
param (
[Alias('c')]
[Parameter()]
[ValidateSet('Debug', 'Release')]
[string]
$Configuration = 'Release',
dotnet build `
-c "Release" `
[Alias('o')]
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]
$OutputPath = 'Netch\bin\Publish\',
[Parameter()]
[bool]
$SelfContained = $False,
[Parameter()]
[bool]
$PublishReadyToRun = $False
)
$PublishSingleFile = $True
Write-Host "Building $Configuration to $OutputPath"
dotnet publish `
-c $Configuration `
-r "win-x64" `
-p:Platform="x64" `
-p:PublishSingleFile=$PublishSingleFile `
-p:SelfContained=$SelfContained `
-p:PublishTrimmed=$SelfContained `
-p:PublishReadyToRun=$PublishReadyToRun `
-o $OutputPath `
Netch\Netch.csproj
if ($LASTEXITCODE) { exit $LASTEXITCODE }

View File

@@ -1,16 +0,0 @@
Write-Host 'Building'
dotnet publish `
-c "Release" `
-r "win-x64" `
-p:Platform="x64" `
-p:PublishSingleFile=true `
-p:SelfContained=false `
-p:PublishTrimmed=false `
-p:PublishReadyToRun=false `
-o Netch\bin\Publish\ `
Netch\Netch.csproj
if ($LASTEXITCODE) { exit $LASTEXITCODE }
Write-Host 'Build done'