diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47e840e3..31850037 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,7 +78,7 @@ jobs: - name: Publish shell: pwsh - run: ci/Publish.ps1 ${{ matrix.runtime }} + run: ci/Publish.ps1 -Runtime ${{ matrix.runtime }} - name: Upload Artifacts uses: actions/upload-artifact@v3 @@ -137,7 +137,7 @@ jobs: - name: Publish shell: pwsh - run: ci/Publish.ps1 ${{ matrix.runtime }} -noSingleFile + run: ci/Publish.ps1 -Runtime ${{ matrix.runtime }} -NoSingleFile - name: Upload Artifacts uses: actions/upload-artifact@v3 diff --git a/ci/Publish.ps1 b/ci/Publish.ps1 index 5ae6445d..6993122a 100644 --- a/ci/Publish.ps1 +++ b/ci/Publish.ps1 @@ -1,16 +1,22 @@ [CmdletBinding()] param ( [Parameter(Mandatory = $true)] - [string] $runtime, - [Parameter()] - [switch] $noSingleFile + [string] $Runtime, + + [string] $OutputDir, + + [string] $Configuration = "Release", + + [string] $BuildPath = "src\Recyclarr", + + [switch] $NoSingleFile ) $ErrorActionPreference = "Stop" -if (-not $noSingleFile) { +if (-not $NoSingleFile) { + $selfContained = "true" $singleFileArgs = @( - "--self-contained=true" "-p:PublishSingleFile=true" "-p:IncludeNativeLibrariesForSelfExtract=true" "-p:PublishReadyToRunComposite=true" @@ -18,9 +24,17 @@ if (-not $noSingleFile) { "-p:EnableCompressionInSingleFile=true" ) } +else { + $selfContained = "false" +} + +if (-not $OutputDir) { + $OutputDir = "publish\$Runtime" +} -dotnet publish src\Recyclarr ` - --output publish\$runtime ` - --configuration Release ` - --runtime $runtime ` +dotnet publish $BuildPath ` + --output $OutputDir ` + --configuration $Configuration ` + --runtime $Runtime ` + --self-contained $selfContained ` $singleFileArgs diff --git a/docker/Build-Artifacts.ps1 b/docker/Build-Artifacts.ps1 index 93807567..12d10d92 100644 --- a/docker/Build-Artifacts.ps1 +++ b/docker/Build-Artifacts.ps1 @@ -1,9 +1,14 @@ [CmdletBinding()] param ( - $runtime = "linux-musl-x64" + $Runtime = "linux-musl-x64" ) -$artifactDir="$PSScriptRoot\artifacts" +$artifactsDir = "$PSScriptRoot\artifacts" -Remove-Item $artifactDir -Recurse -Force -ErrorAction SilentlyContinue -dotnet publish "$PSScriptRoot\..\src\Recyclarr" -o "$artifactDir\recyclarr-$runtime" -r $runtime +Remove-Item $artifactsDir -Recurse -Force -ErrorAction SilentlyContinue + +Push-Location $PSScriptRoot\.. +& ci\Publish.ps1 -NoSingleFile ` + -OutputDir "$artifactsDir\recyclarr-$Runtime" ` + -Runtime $Runtime +Pop-Location