From 5fca9c55fe78fa99eba82bf0e3c9136e7d9cba83 Mon Sep 17 00:00:00 2001 From: Connection Refused Date: Fri, 2 Apr 2021 01:59:23 +0800 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 7 ++----- build.ps1 | 18 +++++++++--------- download.ps1 | 6 ++++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68c594f6..d70d43af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,13 +14,10 @@ jobs: with: fetch-depth: 1 - - name: Download - shell: pwsh - run: .\download.ps1 - - name: Build shell: pwsh - run: .\build.ps1 Release -o release + run: | + .\build.ps1 -Configuration Release -OutputPath release - name: Upload if: ${{ !startsWith(github.ref, 'refs/tags/') }} diff --git a/build.ps1 b/build.ps1 index 50adc1cb..5c34b619 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,15 +1,13 @@ param ( - [Alias('c')] [Parameter()] [ValidateSet('Debug', 'Release')] [string] $Configuration = 'Release', - [Alias('o')] [Parameter()] [ValidateNotNullOrEmpty()] [string] - $OutputPath = 'Netch\bin\Publish\', + $OutputPath = 'release', [Parameter()] [bool] @@ -17,13 +15,16 @@ param ( [Parameter()] [bool] - $PublishReadyToRun = $False + $PublishReadyToRun = $False, + + [Parameter()] + [bool] + $PublishSingleFile = $True, ) -$PublishSingleFile = $True +.\download.ps1 $OutputPath Write-Host "Building $Configuration to $OutputPath" - dotnet publish ` -c $Configuration ` -r "win-x64" ` @@ -35,6 +36,5 @@ dotnet publish ` -o $OutputPath ` Netch\Netch.csproj -if ($LASTEXITCODE) { exit $LASTEXITCODE } - -Write-Host 'Build done' +if ($lastExitCode) { exit $lastExitCode } +exit 0 diff --git a/download.ps1 b/download.ps1 index 450c9051..3b7f61bc 100644 --- a/download.ps1 +++ b/download.ps1 @@ -1,9 +1,11 @@ +param([string]$OutputPath) + $NetchDataURL="https://github.com/NetchX/NetchData/archive/refs/heads/master.zip" $NetchModeURL="https://github.com/NetchX/NetchMode/archive/refs/heads/master.zip" $NetchI18NURL="https://github.com/NetchX/NetchTranslation/archive/refs/heads/master.zip" -New-Item -ItemType Directory -Name release | Out-Null -Set-Location release +New-Item -ItemType Directory -Name $OutputPath | Out-Null +Set-Location $OutputPath Invoke-WebRequest -Uri $NetchDataURL -OutFile data.zip Invoke-WebRequest -Uri $NetchModeURL -OutFile mode.zip