diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a6cdbf7..2930bedc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,10 +14,18 @@ jobs: - name: Checksum shell: pwsh run: | + echo "SOURCE_NETCH_SHA256=$(.\sha256.ps1 .\Netch)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV echo "SOURCE_OTHER_SHA256=$(.\sha256.ps1 .\Other)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV echo "SOURCE_REDIRECTOR_SHA256=$(.\sha256.ps1 .\Redirector)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV echo "SOURCE_ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV + - name: Cache Netch + uses: actions/cache@v2 + with: + key: Netch-${{ runner.os }}-Netch-${{ env.SOURCE_NETCH_SHA256 }} + path: | + .\Netch\bin + - name: Cache Other uses: actions/cache@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6bebd1fd..358f69c9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,16 +17,17 @@ jobs: - name: Checksum shell: pwsh run: | + echo "SOURCE_NETCH_SHA256=$(.\sha256.ps1 .\Netch)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV echo "SOURCE_OTHER_SHA256=$(.\sha256.ps1 .\Other)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV echo "SOURCE_REDIRECTOR_SHA256=$(.\sha256.ps1 .\Redirector)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV echo "SOURCE_ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV - - name: Cache Other + - name: Cache Netch uses: actions/cache@v2 with: - key: Netch-${{ runner.os }}-Other-${{ env.SOURCE_OTHER_SHA256 }} + key: Netch-${{ runner.os }}-Netch-${{ env.SOURCE_NETCH_SHA256 }} path: | - .\Other\release + .\Netch\bin - name: Cache Redirector uses: actions/cache@v2 diff --git a/build.ps1 b/build.ps1 index d3bfc6c4..f6fb238e 100644 --- a/build.ps1 +++ b/build.ps1 @@ -15,7 +15,7 @@ param ( [Parameter()] [bool] - $PublishReadyToRun = $False, + $PublishReadyToRun = $True, [Parameter()] [bool] @@ -45,20 +45,24 @@ cp -Force '.\Other\release\*.bin' "$OutputPath\bin" cp -Force '.\Other\release\*.dll' "$OutputPath\bin" cp -Force '.\Other\release\*.exe' "$OutputPath\bin" -Write-Host -Write-Host 'Building Netch' -dotnet publish ` - -c "$Configuration" ` - -r 'win-x64' ` - -p:Platform='x64' ` - -p:SelfContained="$SelfContained" ` - -p:PublishTrimmed="$SelfContained" ` - -p:PublishReadyToRun="$PublishReadyToRun" ` - -p:PublishSingleFile="$PublishSingleFile" ` - -p:IncludeNativeLibrariesForSelfExtract="$SelfContained" ` - -o "$OutputPath" ` - '.\Netch\Netch.csproj' -if ( -Not $? ) { exit $lastExitCode } +if ( -Not ( Test-Path ".\Netch\bin\$Configuration" ) ) { + Write-Host + Write-Host 'Building Netch' + + dotnet publish ` + -c "$Configuration" ` + -r 'win-x64' ` + -p:Platform='x64' ` + -p:SelfContained="$SelfContained" ` + -p:PublishTrimmed="$SelfContained" ` + -p:PublishReadyToRun="$PublishReadyToRun" ` + -p:PublishSingleFile="$PublishSingleFile" ` + -p:IncludeNativeLibrariesForSelfExtract="$SelfContained" ` + -o ".\Netch\bin\$Configuration" ` + '.\Netch\Netch.csproj' + if ( -Not $? ) { exit $lastExitCode } +} +cp -Force ".\Netch\bin\$Configuration\Netch.exe" "$OutputPath\bin" if ( -Not ( Test-Path ".\Redirector\bin\$Configuration" ) ) { Write-Host