diff --git a/.github/actions/package/action.yml b/.github/actions/package/action.yml index bd281ddb0..831caf7e7 100644 --- a/.github/actions/package/action.yml +++ b/.github/actions/package/action.yml @@ -2,6 +2,12 @@ name: Package description: Packages binaries for deployment inputs: + platform: + description: 'Binary platform' + required: true + framework: + description: '.net framework' + required: true artifact: description: 'Binary artifact' required: true @@ -18,7 +24,7 @@ inputs: runs: using: 'composite' steps: - - name: Download UI Artifact + - name: Download Artifact uses: actions/download-artifact@v4 with: name: ${{ inputs.artifact }} @@ -27,19 +33,48 @@ runs: - name: Download UI Artifact uses: actions/download-artifact@v4 with: - name: ui + name: build_ui path: _output/UI + - name: Configure Environment Variables + shell: bash + runs: | + echo "FRAMEWORK=${{ inputs.framework }}" >> "$GITHUB_ENV" + echo "BRANCH=${{ inputs.branch }}" >> "$GITHUB_ENV" + echo "SONARR_MAJOR_VERSION=${{ inputs.major_version }}" >> "$GITHUB_ENV" + echo "SONARR_VERSION=${{ inputs.version }}" >> "$GITHUB_ENV" + - name: Create Packages shell: bash run: $GITHUB_ACTION_PATH/package.sh - - name: List Artifacts + - name: Create Windows Installer (x64) + if: ${{ inputs.platform == 'windows' }} + shell: cmd + run: | + SET RUNTIME=win-x64 + + cd ./distribution/windows/setup + ./distribution/windows/setup/build.bat + + - name: Create Windows Installer (x86) + if: ${{ inputs.platform == 'windows' }} + shell: cmd + run: | + SET RUNTIME=win-x86 + + cd ./distribution/windows/setup + ./distribution/windows/setup/build.bat + + - name: List Artifacts (Testing) shell: bash run: ls -l _artifacts - # - name: Upload Artifact - # uses: actions/upload-artifact@v4 - # with: - # name: ${{ env.RESULTS_NAME }} - # path: ${{ env.RESULTS_NAME }} + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: release_${{ inputs.platform }} + path: | + _artifacts/*.exe + _artifacts/*.tar.gz + _artifacts/*.zip diff --git a/.github/actions/package/package.sh b/.github/actions/package/package.sh index 8a70303dd..7f19664d9 100755 --- a/.github/actions/package/package.sh +++ b/.github/actions/package/package.sh @@ -3,20 +3,17 @@ outputFolder=_output artifactsFolder=_artifacts uiFolder="$outputFolder/UI" +framework="${FRAMEWORK:=net6.0}" -for folder in _artifacts/* +for runtime in _artifacts/* do - name="${folder##*/}" - folderName="$outputFolder/$name" + name="${runtime##*/}" + folderName="$runtime/$framework/Sonarr" sonarrFolder="$folderName/Sonarr" echo "Creating package for $name" - rm -rf $folderName - mkdir $folderName - cp -r "$folder/net6.0/Sonarr" $sonarrFolder - - echo "Copying UI folder" + echo "Copying UI runtime" cp -r $uiFolder $sonarrFolder echo "Setting permissions" diff --git a/.github/actions/publish-artifact/action.yml b/.github/actions/publish-artifact/action.yml deleted file mode 100644 index f06cea06b..000000000 --- a/.github/actions/publish-artifact/action.yml +++ /dev/null @@ -1,17 +0,0 @@ -# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action - -name: Publish Artifact -description: Publishes a build artifact - -inputs: - runtime: - description: '.net runtime' - required: true - -runs: - using: 'composite' - steps: - - uses: actions/upload-artifact@v4 - with: - name: ${{ inputs.runtime }} - path: _artifacts/${{ inputs.runtime }}/net6.0/**/* diff --git a/.github/actions/publish-test-artifact/action.yml b/.github/actions/publish-test-artifact/action.yml index 9a1e3709e..66c4b8644 100644 --- a/.github/actions/publish-test-artifact/action.yml +++ b/.github/actions/publish-test-artifact/action.yml @@ -4,6 +4,9 @@ name: Publish Test Artifact description: Publishes a test artifact inputs: + framework: + description: '.net framework' + required: true runtime: description: '.net runtime' required: true @@ -14,4 +17,4 @@ runs: - uses: actions/upload-artifact@v4 with: name: tests-${{ inputs.runtime }} - path: _tests/net6.0/${{ inputs.runtime }}/publish/**/* + path: _tests/${{ inputs.framework }}/${{ inputs.runtime }}/publish/**/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 89972628d..d3c5284d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,8 @@ concurrency: cancel-in-progress: true env: - BRANCH: ${{ github.head_ref || github.ref_name }} + FRAMEWORK: net6.0 + BRANCH: ${{ github.head_ref || github.ref_name }} SONARR_MAJOR_VERSION: 4 VERSION: 4.0.0 @@ -22,6 +23,7 @@ jobs: backend: runs-on: windows-latest outputs: + framework: ${{ steps.variables.outputs.framework }} major_version: ${{ steps.variables.outputs.major_version }} version: ${{ steps.variables.outputs.version }} steps: @@ -38,6 +40,7 @@ jobs: DOTNET_VERSION=$(jq -r '.sdk.version' global.json) echo "SDK_PATH=${{ env.DOTNET_ROOT }}/sdk/${DOTNET_VERSION}" >> "$GITHUB_ENV" echo "SONARR_VERSION=${{ env.VERSION }}.${{ github.run_number }}" >> "$GITHUB_ENV" + echo "framework=${{ env.FRAMEWORK }}" >> "$GITHUB_OUTPUT" echo "major_version=${{ env.SONARR_MAJOR_VERSION }}" >> "$GITHUB_OUTPUT" echo "version=${{ env.VERSION }}.${{ github.run_number }}" >> "$GITHUB_OUTPUT" @@ -54,16 +57,19 @@ jobs: - name: Publish win-x64 Test Artifact uses: ./.github/actions/publish-test-artifact with: + framework: ${{ env.FRAMEWORK }} runtime: win-x64 - name: Publish linux-x64 Test Artifact uses: ./.github/actions/publish-test-artifact with: + framework: ${{ env.FRAMEWORK }} runtime: linux-x64 - name: Publish osx-x64 Test Artifact uses: ./.github/actions/publish-test-artifact with: + framework: ${{ env.FRAMEWORK }} runtime: osx-x64 # Build Artifacts (grouped by OS) @@ -113,7 +119,7 @@ jobs: - name: Publish UI Artifact uses: actions/upload-artifact@v4 with: - name: ui + name: build_ui path: _output/UI/**/* unit_test: @@ -170,17 +176,17 @@ jobs: artifact: tests-linux-x64 filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest binary_artifact: build_linux - binary_path: linux-x64/net6.0/Sonarr + binary_path: linux-x64/${{ needs.backend.outputs.framework }}/Sonarr - os: macos-latest artifact: tests-osx-x64 filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest binary_artifact: build_macos - binary_path: osx-x64/net6.0/Sonarr + binary_path: osx-x64/${{ needs.backend.outputs.framework }}/Sonarr - os: windows-latest artifact: tests-win-x64 filter: TestCategory!=ManualTest&TestCategory=WINDOWS&TestCategory=IntegrationTest binary_artifact: build_windows - binary_path: win-x64/net6.0/Sonarr + binary_path: win-x64/${{ needs.backend.outputs.framework }}/Sonarr runs-on: ${{ matrix.os }} steps: - name: Check out @@ -203,6 +209,7 @@ jobs: secrets: inherit uses: ./.github/workflows/deploy.yml with: + framework: ${{ needs.backend.outputs.framework }} branch: ${{ github.ref_name }} major_version: ${{ needs.backend.outputs.major_version }} version: ${{ needs.backend.outputs.version }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1ee7aea24..4f2443166 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,19 +3,39 @@ name: Deploy on: workflow_call: inputs: + framework: + description: '.net framework' + type: string + required: true branch: - required: true + description: 'Git branch used for this build' type: string + required: true major_version: - required: true + description: 'Sonarr major version' type: string + required: true version: - required: true + description: 'Sonarr version' type: string + required: true jobs: - package_windows: - runs-on: windows-latest + package: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + platform: freebsd + - os: ubuntu-latest + platform: linux + - os: ubuntu-latest + platform: macos + - os: windows-latest + platform: windows + + runs-on: ${{ matrix.os }} steps: - name: Check out uses: actions/checkout@v3 @@ -23,19 +43,9 @@ jobs: - name: Package uses: ./.github/actions/package with: - artifact: build_windows + framework: ${{ inputs.framework }} + platform: ${{ matrix.platform }} + artifact: build_${{ matrix.platform }} branch: ${{ inputs.branch }} + major_version: ${{ inputs.major_version }} version: ${{ inputs.version }} - - - # package_linux: - # runs-on: ubuntu-latest - # steps: - # - name: Check out - # uses: actions/checkout@v3 - - # - name: Download Artifact - # uses: actions/download-artifact@v4 - # with: - # name: build_linux - # path: _artifacts diff --git a/build.sh b/build.sh index 52049aa06..ee59d2f61 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,7 @@ set -e outputFolder='_output' testPackageFolder='_tests' artifactsFolder="_artifacts"; +framework="${FRAMEWORK:=net6.0}" ProgressStart() { @@ -138,7 +139,7 @@ PackageLinux() echo "Adding Sonarr.Mono to UpdatePackage" cp $folder/Sonarr.Mono.* $folder/Sonarr.Update - if [ "$framework" = "net6.0" ]; then + if [ "$framework" = "$framework" ]; then cp $folder/Mono.Posix.NETStandard.* $folder/Sonarr.Update cp $folder/libMonoPosixHelper.* $folder/Sonarr.Update fi @@ -166,7 +167,7 @@ PackageMacOS() echo "Adding Sonarr.Mono to UpdatePackage" cp $folder/Sonarr.Mono.* $folder/Sonarr.Update - if [ "$framework" = "net6.0" ]; then + if [ "$framework" = "$framework" ]; then cp $folder/Mono.Posix.NETStandard.* $folder/Sonarr.Update cp $folder/libMonoPosixHelper.* $folder/Sonarr.Update fi @@ -398,20 +399,20 @@ then if [[ -z "$RID" || -z "$FRAMEWORK" ]]; then - PackageTests "net6.0" "win-x64" - PackageTests "net6.0" "win-x86" - PackageTests "net6.0" "linux-x64" - PackageTests "net6.0" "linux-musl-x64" - PackageTests "net6.0" "osx-x64" + PackageTests "$framework" "win-x64" + PackageTests "$framework" "win-x86" + PackageTests "$framework" "linux-x64" + PackageTests "$framework" "linux-musl-x64" + PackageTests "$framework" "osx-x64" if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ]; then - PackageTests "net6.0" "freebsd-x64" + PackageTests "$framework" "freebsd-x64" fi else PackageTests "$FRAMEWORK" "$RID" fi - UploadTestArtifacts "net6.0" + UploadTestArtifacts "$framework" fi if [ "$FRONTEND" = "YES" ]; @@ -433,22 +434,22 @@ then if [[ -z "$RID" || -z "$FRAMEWORK" ]]; then - Package "net6.0" "win-x64" - Package "net6.0" "win-x86" - Package "net6.0" "linux-x64" - Package "net6.0" "linux-musl-x64" - Package "net6.0" "linux-arm64" - Package "net6.0" "linux-musl-arm64" - Package "net6.0" "linux-arm" - Package "net6.0" "osx-x64" - Package "net6.0" "osx-arm64" + Package "$framework" "win-x64" + Package "$framework" "win-x86" + Package "$framework" "linux-x64" + Package "$framework" "linux-musl-x64" + Package "$framework" "linux-arm64" + Package "$framework" "linux-musl-arm64" + Package "$framework" "linux-arm" + Package "$framework" "osx-x64" + Package "$framework" "osx-arm64" if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ]; then - Package "net6.0" "freebsd-x64" + Package "$framework" "freebsd-x64" fi else Package "$FRAMEWORK" "$RID" fi - UploadArtifacts "net6.0" + UploadArtifacts "$framework" fi diff --git a/docs.sh b/docs.sh index 685a4d6e0..a0f21c41a 100755 --- a/docs.sh +++ b/docs.sh @@ -1,6 +1,7 @@ #!/bin/bash set -e +FRAMEWORK="net6.0" PLATFORM=$1 if [ "$PLATFORM" = "Windows" ]; then @@ -32,7 +33,7 @@ dotnet msbuild -restore $slnFile -p:Configuration=Debug -p:Platform=$platform -p dotnet new tool-manifest dotnet tool install --version 6.5.0 Swashbuckle.AspNetCore.Cli -dotnet tool run swagger tofile --output ./src/Sonarr.Api.V3/openapi.json "$outputFolder/net6.0/$RUNTIME/Sonarr.dll" v3 & +dotnet tool run swagger tofile --output ./src/Sonarr.Api.V3/openapi.json "$outputFolder/$FRAMEWORK/$RUNTIME/Sonarr.dll" v3 & sleep 30