mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-05 13:20:20 -05:00
Improve build speed
This commit is contained in:
188
.github/actions/build/action.yml
vendored
Normal file
188
.github/actions/build/action.yml
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
name: Build Backend
|
||||
description: Builds the backend and packages it
|
||||
|
||||
inputs:
|
||||
branch:
|
||||
description: "Branch name for this build"
|
||||
required: true
|
||||
version:
|
||||
description: "Version number to build"
|
||||
required: true
|
||||
framework:
|
||||
description: ".net framework used for the build"
|
||||
required: true
|
||||
runtime:
|
||||
description: "Run time to build for"
|
||||
required: true
|
||||
package_tests:
|
||||
description: "True if tests should be packaged for later testing steps"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
|
||||
- name: Setup Environment Variables
|
||||
id: variables
|
||||
shell: bash
|
||||
run: |
|
||||
DOTNET_VERSION=$(jq -r '.sdk.version' global.json)
|
||||
|
||||
echo "SDK_PATH=${{ env.DOTNET_ROOT }}/sdk/${DOTNET_VERSION}" >> "$GITHUB_ENV"
|
||||
echo "SONARR_VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
|
||||
echo "BRANCH=${{ inputs.branch }}" >> "$GITHUB_ENV"
|
||||
|
||||
if [ "$RUNNER_OS" == "Windows" ]; then
|
||||
echo "NUGET_PACKAGES=D:\nuget\packages" >> "$GITHUB_ENV"
|
||||
fi
|
||||
|
||||
- name: Enable Extra Platforms In SDK
|
||||
if: ${{ inputs.runtime == 'freebsd-x64' }}
|
||||
shell: bash
|
||||
run: |
|
||||
BUNDLEDVERSIONS="${SDK_PATH}/Microsoft.NETCoreSdk.BundledVersions.props"
|
||||
|
||||
if grep -q freebsd-x64 "$BUNDLEDVERSIONS"; then
|
||||
echo "Extra platforms already enabled"
|
||||
else
|
||||
echo "Enabling extra platform support"
|
||||
sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64/' "$BUNDLEDVERSIONS"
|
||||
fi
|
||||
|
||||
if grep -qv freebsd-x64 src/Directory.Build.props; then
|
||||
sed -i'' -e "s^<RuntimeIdentifiers>\(.*\)</RuntimeIdentifiers>^<RuntimeIdentifiers>\1;freebsd-x64</RuntimeIdentifiers>^g" src/Directory.Build.props
|
||||
fi
|
||||
|
||||
- name: Update Version Number
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$SONARR_VERSION" != "" ]; then
|
||||
echo "Updating version info to: $SONARR_VERSION"
|
||||
sed -i'' -e "s/<AssemblyVersion>[0-9.*]\+<\/AssemblyVersion>/<AssemblyVersion>$SONARR_VERSION<\/AssemblyVersion>/g" src/Directory.Build.props
|
||||
sed -i'' -e "s/<AssemblyConfiguration>[\$()A-Za-z-]\+<\/AssemblyConfiguration>/<AssemblyConfiguration>${BRANCH}<\/AssemblyConfiguration>/g" src/Directory.Build.props
|
||||
sed -i'' -e "s/<string>10.0.0.0<\/string>/<string>$SONARR_VERSION<\/string>/g" distribution/macOS/Sonarr.app/Contents/Info.plist
|
||||
fi
|
||||
|
||||
- name: Build Backend
|
||||
shell: bash
|
||||
run: |
|
||||
runtime="${{ inputs.runtime }}"
|
||||
platform=Windows
|
||||
slnFile=src/Sonarr.sln
|
||||
targetingWindows=false
|
||||
|
||||
IFS='-' read -ra SPLIT <<< "$runtime"
|
||||
|
||||
if [ "${SPLIT[0]}" == "win" ]; then
|
||||
platform=Windows
|
||||
targetingWindows=true
|
||||
else
|
||||
platform=Posix
|
||||
fi
|
||||
|
||||
rm -rf _output
|
||||
rm -rf _tests
|
||||
|
||||
echo "Building Sonarr for $runtime, Platform: $platform"
|
||||
|
||||
dotnet msbuild -restore $slnFile -p:SelfContained=True -p:Configuration=Release -p:Platform=$platform -p:RuntimeIdentifiers=$runtime -p:EnableWindowsTargeting=true -t:PublishAllRids
|
||||
|
||||
- name: Package
|
||||
shell: bash
|
||||
run: |
|
||||
framework="${{ inputs.framework }}"
|
||||
runtime="${{ inputs.runtime }}"
|
||||
|
||||
IFS='-' read -ra SPLIT <<< "$runtime"
|
||||
|
||||
case "${SPLIT[0]}" in
|
||||
linux|freebsd*)
|
||||
folder=_artifacts/$runtime/$framework/Sonarr
|
||||
|
||||
echo "Packaging files"
|
||||
rm -rf $folder
|
||||
mkdir -p $folder
|
||||
cp -r _output/$framework/$runtime/publish/* $folder
|
||||
cp -r _output/Sonarr.Update/$framework/$runtime/publish $folder/Sonarr.Update
|
||||
cp LICENSE.md $folder
|
||||
|
||||
echo "Removing Service helpers"
|
||||
rm -f $folder/ServiceUninstall.*
|
||||
rm -f $folder/ServiceInstall.*
|
||||
|
||||
echo "Removing Sonarr.Windows"
|
||||
rm $folder/Sonarr.Windows.*
|
||||
|
||||
echo "Adding Sonarr.Mono to UpdatePackage"
|
||||
cp $folder/Sonarr.Mono.* $folder/Sonarr.Update
|
||||
cp $folder/Mono.Posix.NETStandard.* $folder/Sonarr.Update
|
||||
cp $folder/libMonoPosixHelper.* $folder/Sonarr.Update
|
||||
;;
|
||||
win)
|
||||
folder=_artifacts/$runtime/$framework/Sonarr
|
||||
|
||||
echo "Packaging files"
|
||||
rm -rf $folder
|
||||
mkdir -p $folder
|
||||
cp -r _output/$framework/$runtime/publish/* $folder
|
||||
cp -r _output/Sonarr.Update/$framework/$runtime/publish $folder/Sonarr.Update
|
||||
cp LICENSE.md $folder
|
||||
cp -r _output/$framework-windows/$runtime/publish/* $folder
|
||||
|
||||
echo "Removing Sonarr.Mono"
|
||||
rm -f $folder/Sonarr.Mono.*
|
||||
rm -f $folder/Mono.Posix.NETStandard.*
|
||||
rm -f $folder/libMonoPosixHelper.*
|
||||
|
||||
echo "Adding Sonarr.Windows to UpdatePackage"
|
||||
cp $folder/Sonarr.Windows.* $folder/Sonarr.Update
|
||||
|
||||
;;
|
||||
osx)
|
||||
folder=_artifacts/$runtime/$framework/Sonarr
|
||||
|
||||
echo "Packaging files"
|
||||
rm -rf $folder
|
||||
mkdir -p $folder
|
||||
cp -r _output/$framework/$runtime/publish/* $folder
|
||||
cp -r _output/Sonarr.Update/$framework/$runtime/publish $folder/Sonarr.Update
|
||||
cp LICENSE.md $folder
|
||||
|
||||
echo "Removing Service helpers"
|
||||
rm -f $folder/ServiceUninstall.*
|
||||
rm -f $folder/ServiceInstall.*
|
||||
|
||||
echo "Removing Sonarr.Windows"
|
||||
rm $folder/Sonarr.Windows.*
|
||||
|
||||
echo "Adding Sonarr.Mono to UpdatePackage"
|
||||
cp $folder/Sonarr.Mono.* $folder/Sonarr.Update
|
||||
cp $folder/Mono.Posix.NETStandard.* $folder/Sonarr.Update
|
||||
cp $folder/libMonoPosixHelper.* $folder/Sonarr.Update
|
||||
;;
|
||||
esac
|
||||
|
||||
- name: Package Tests
|
||||
if: ${{ inputs.package_tests }}
|
||||
shell: bash
|
||||
run: |
|
||||
framework="${{ inputs.framework }}"
|
||||
runtime="${{ inputs.runtime }}"
|
||||
|
||||
cp test.sh "_tests/$framework/$runtime/publish"
|
||||
|
||||
rm -f _tests/$framework/$runtime/*.log.config
|
||||
|
||||
- name: Upload Test Artifacts
|
||||
if: ${{ inputs.package_tests }}
|
||||
uses: ./.github/actions/publish-test-artifact
|
||||
with:
|
||||
framework: ${{ inputs.framework }}
|
||||
runtime: ${{ inputs.runtime }}
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-${{ inputs.runtime }}
|
||||
path: _artifacts/**/*
|
||||
26
.github/actions/package/action.yml
vendored
26
.github/actions/package/action.yml
vendored
@@ -2,34 +2,34 @@ name: Package
|
||||
description: Packages binaries for deployment
|
||||
|
||||
inputs:
|
||||
platform:
|
||||
description: 'Binary platform'
|
||||
runtime:
|
||||
description: "Binary runtime"
|
||||
required: true
|
||||
framework:
|
||||
description: '.net framework'
|
||||
framework:
|
||||
description: ".net framework"
|
||||
required: true
|
||||
artifact:
|
||||
description: 'Binary artifact'
|
||||
description: "Binary artifact"
|
||||
required: true
|
||||
branch:
|
||||
description: 'Git branch used for this build'
|
||||
description: "Git branch used for this build"
|
||||
required: true
|
||||
major_version:
|
||||
description: 'Sonarr major version'
|
||||
description: "Sonarr major version"
|
||||
required: true
|
||||
version:
|
||||
description: 'Sonarr version'
|
||||
description: "Sonarr version"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ inputs.artifact }}
|
||||
path: _output
|
||||
|
||||
|
||||
- name: Download UI Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
@@ -49,7 +49,7 @@ runs:
|
||||
run: $GITHUB_ACTION_PATH/package.sh
|
||||
|
||||
- name: Create Windows Installer (x64)
|
||||
if: ${{ inputs.platform == 'windows' }}
|
||||
if: ${{ inputs.runtime == 'win-x64' }}
|
||||
working-directory: distribution/windows/setup
|
||||
shell: cmd
|
||||
run: |
|
||||
@@ -58,7 +58,7 @@ runs:
|
||||
build.bat
|
||||
|
||||
- name: Create Windows Installer (x86)
|
||||
if: ${{ inputs.platform == 'windows' }}
|
||||
if: ${{ inputs.runtime == 'win-x86' }}
|
||||
working-directory: distribution/windows/setup
|
||||
shell: cmd
|
||||
run: |
|
||||
@@ -69,7 +69,7 @@ runs:
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release_${{ inputs.platform }}
|
||||
name: release-${{ inputs.runtime }}
|
||||
compression-level: 0
|
||||
if-no-files-found: error
|
||||
path: |
|
||||
|
||||
@@ -3,13 +3,12 @@ name: Build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
- v5-develop
|
||||
- v5-main
|
||||
paths-ignore:
|
||||
- "src/Sonarr.Api.*/openapi.json"
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
- v5-develop
|
||||
paths-ignore:
|
||||
- "src/NzbDrone.Core/Localization/Core/**"
|
||||
@@ -22,89 +21,77 @@ concurrency:
|
||||
env:
|
||||
FRAMEWORK: net8.0
|
||||
RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||
SONARR_MAJOR_VERSION: 4
|
||||
VERSION: 4.0.13
|
||||
SONARR_MAJOR_VERSION: 5
|
||||
VERSION: 5.0.0
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
runs-on: windows-latest
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
framework: ${{ steps.variables.outputs.framework }}
|
||||
major_version: ${{ steps.variables.outputs.major_version }}
|
||||
version: ${{ steps.variables.outputs.version }}
|
||||
branch: ${{ steps.variables.outputs.branch }}
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
|
||||
- name: Setup Environment Variables
|
||||
id: variables
|
||||
shell: bash
|
||||
run: |
|
||||
# Add 800 to the build number because GitHub won't let us pick an arbitrary starting point
|
||||
SONARR_VERSION="${{ env.VERSION }}.$((${{ github.run_number }}+800))"
|
||||
DOTNET_VERSION=$(jq -r '.sdk.version' global.json)
|
||||
|
||||
echo "SDK_PATH=${{ env.DOTNET_ROOT }}/sdk/${DOTNET_VERSION}" >> "$GITHUB_ENV"
|
||||
echo "SONARR_VERSION=$SONARR_VERSION" >> "$GITHUB_ENV"
|
||||
echo "BRANCH=${RAW_BRANCH_NAME//\//-}" >> "$GITHUB_ENV"
|
||||
|
||||
echo "framework=${{ env.FRAMEWORK }}" >> "$GITHUB_OUTPUT"
|
||||
echo "major_version=${{ env.SONARR_MAJOR_VERSION }}" >> "$GITHUB_OUTPUT"
|
||||
echo "version=$SONARR_VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "version=${{ env.VERSION }}.$((${{ github.run_number }}))" >> "$GITHUB_OUTPUT"
|
||||
echo "branch=${RAW_BRANCH_NAME//\//-}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Enable Extra Platforms In SDK
|
||||
shell: bash
|
||||
run: ./build.sh --enable-extra-platforms-in-sdk
|
||||
backend:
|
||||
needs: prepare
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- runtime: freebsd-x64
|
||||
package_tests: false
|
||||
os: ubuntu-latest
|
||||
- runtime: linux-arm
|
||||
package_tests: false
|
||||
os: ubuntu-latest
|
||||
- runtime: linux-arm64
|
||||
package_tests: false
|
||||
os: ubuntu-latest
|
||||
- runtime: linux-musl-arm64
|
||||
package_tests: false
|
||||
os: ubuntu-latest
|
||||
- runtime: linux-musl-x64
|
||||
package_tests: false
|
||||
os: ubuntu-latest
|
||||
- runtime: linux-x64
|
||||
package_tests: true
|
||||
os: ubuntu-latest
|
||||
- runtime: osx-arm64
|
||||
package_tests: true
|
||||
os: ubuntu-latest
|
||||
- runtime: osx-x64
|
||||
package_tests: false
|
||||
os: ubuntu-latest
|
||||
- runtime: win-x64
|
||||
package_tests: true
|
||||
os: ubuntu-latest
|
||||
- runtime: win-x86
|
||||
package_tests: false
|
||||
os: ubuntu-latest
|
||||
|
||||
- name: Build Backend
|
||||
shell: bash
|
||||
run: ./build.sh --backend --enable-extra-platforms --packages
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Test Artifacts
|
||||
|
||||
- name: Publish win-x64 Test Artifact
|
||||
uses: ./.github/actions/publish-test-artifact
|
||||
- name: Build
|
||||
uses: ./.github/actions/build
|
||||
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-arm64 Test Artifact
|
||||
uses: ./.github/actions/publish-test-artifact
|
||||
with:
|
||||
framework: ${{ env.FRAMEWORK }}
|
||||
runtime: osx-arm64
|
||||
|
||||
# Build Artifacts (grouped by OS)
|
||||
|
||||
- name: Publish FreeBSD Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build_freebsd
|
||||
path: _artifacts/freebsd-*/**/*
|
||||
- name: Publish Linux Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build_linux
|
||||
path: _artifacts/linux-*/**/*
|
||||
- name: Publish macOS Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build_macos
|
||||
path: _artifacts/osx-*/**/*
|
||||
- name: Publish Windows Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build_windows
|
||||
path: _artifacts/win-*/**/*
|
||||
branch: ${{ needs.prepare.outputs.branch }}
|
||||
version: ${{ needs.prepare.outputs.version }}
|
||||
framework: ${{ needs.prepare.outputs.framework }}
|
||||
runtime: ${{ matrix.runtime }}
|
||||
package_tests: ${{ matrix.package_tests }}
|
||||
|
||||
frontend:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -179,7 +166,7 @@ jobs:
|
||||
use_postgres: true
|
||||
|
||||
integration_test:
|
||||
needs: backend
|
||||
needs: [prepare, backend]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -188,18 +175,18 @@ jobs:
|
||||
- os: ubuntu-latest
|
||||
artifact: tests-linux-x64
|
||||
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest
|
||||
binary_artifact: build_linux
|
||||
binary_path: linux-x64/${{ needs.backend.outputs.framework }}/Sonarr
|
||||
binary_artifact: build-linux-x64
|
||||
binary_path: linux-x64/${{ needs.prepare.outputs.framework }}/Sonarr
|
||||
- os: macos-latest
|
||||
artifact: tests-osx-arm64
|
||||
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest
|
||||
binary_artifact: build_macos
|
||||
binary_path: osx-arm64/${{ needs.backend.outputs.framework }}/Sonarr
|
||||
binary_artifact: build-osx-arm64
|
||||
binary_path: osx-arm64/${{ needs.prepare.outputs.framework }}/Sonarr
|
||||
- os: windows-latest
|
||||
artifact: tests-win-x64
|
||||
filter: TestCategory!=ManualTest&TestCategory!=LINUX&TestCategory=IntegrationTest
|
||||
binary_artifact: build_windows
|
||||
binary_path: win-x64/${{ needs.backend.outputs.framework }}/Sonarr
|
||||
binary_artifact: build-win-x64
|
||||
binary_path: win-x64/${{ needs.prepare.outputs.framework }}/Sonarr
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out
|
||||
@@ -217,20 +204,29 @@ jobs:
|
||||
binary_path: ${{ matrix.binary_path }}
|
||||
|
||||
deploy:
|
||||
if: ${{ github.ref_name == 'develop' || github.ref_name == 'main' }}
|
||||
needs: [backend, frontend, unit_test, unit_test_postgres, integration_test]
|
||||
if: ${{ github.ref_name == 'v5-develop' || github.ref_name == 'v5-main' }}
|
||||
needs:
|
||||
[
|
||||
prepare,
|
||||
backend,
|
||||
frontend,
|
||||
unit_test,
|
||||
unit_test_postgres,
|
||||
integration_test,
|
||||
]
|
||||
secrets: inherit
|
||||
uses: ./.github/workflows/deploy.yml
|
||||
with:
|
||||
framework: ${{ needs.backend.outputs.framework }}
|
||||
framework: ${{ needs.prepare.outputs.framework }}
|
||||
branch: ${{ github.ref_name }}
|
||||
major_version: ${{ needs.backend.outputs.major_version }}
|
||||
version: ${{ needs.backend.outputs.version }}
|
||||
major_version: ${{ needs.prepare.outputs.major_version }}
|
||||
version: ${{ needs.prepare.outputs.version }}
|
||||
|
||||
notify:
|
||||
name: Discord Notification
|
||||
needs:
|
||||
[
|
||||
prepare,
|
||||
backend,
|
||||
frontend,
|
||||
unit_test,
|
||||
@@ -238,7 +234,7 @@ jobs:
|
||||
integration_test,
|
||||
deploy,
|
||||
]
|
||||
if: ${{ !cancelled() && (github.ref_name == 'develop' || github.ref_name == 'main') }}
|
||||
if: ${{ !cancelled() && (github.ref_name == 'v5-develop' || github.ref_name == 'v5-main') }}
|
||||
env:
|
||||
STATUS: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
@@ -254,5 +250,5 @@ jobs:
|
||||
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
embed-description: |
|
||||
**Branch** ${{ github.ref }}
|
||||
**Build** ${{ needs.backend.outputs.version }}
|
||||
**Build** ${{ needs.prepare.outputs.version }}
|
||||
embed-color: ${{ env.STATUS == 'success' && '3066993' || '15158332' }}
|
||||
241
.github/workflows/deploy.yml
vendored
241
.github/workflows/deploy.yml
vendored
@@ -3,20 +3,20 @@ name: Deploy
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
framework:
|
||||
description: '.net framework'
|
||||
framework:
|
||||
description: ".net framework"
|
||||
type: string
|
||||
required: true
|
||||
branch:
|
||||
description: 'Git branch used for this build'
|
||||
description: "Git branch used for this build"
|
||||
type: string
|
||||
required: true
|
||||
major_version:
|
||||
description: 'Sonarr major version'
|
||||
description: "Sonarr major version"
|
||||
type: string
|
||||
required: true
|
||||
version:
|
||||
description: 'Sonarr version'
|
||||
description: "Sonarr version"
|
||||
type: string
|
||||
required: true
|
||||
secrets:
|
||||
@@ -27,31 +27,42 @@ jobs:
|
||||
package:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [freebsd, linux, macos, windows]
|
||||
include:
|
||||
- platform: freebsd
|
||||
- runtime: freebsd-x64
|
||||
os: ubuntu-latest
|
||||
- platform: linux
|
||||
- runtime: linux-arm
|
||||
os: ubuntu-latest
|
||||
- platform: macos
|
||||
- runtime: linux-arm64
|
||||
os: ubuntu-latest
|
||||
- platform: windows
|
||||
- runtime: linux-musl-arm64
|
||||
os: ubuntu-latest
|
||||
- runtime: linux-musl-x64
|
||||
os: ubuntu-latest
|
||||
- runtime: linux-x64
|
||||
os: ubuntu-latest
|
||||
- runtime: osx-arm64
|
||||
os: ubuntu-latest
|
||||
- runtime: osx-x64
|
||||
os: ubuntu-latest
|
||||
- runtime: win-x64
|
||||
os: windows-latest
|
||||
- runtime: win-x86
|
||||
os: windows-latest
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
with:
|
||||
framework: ${{ inputs.framework }}
|
||||
platform: ${{ matrix.platform }}
|
||||
artifact: build_${{ matrix.platform }}
|
||||
branch: ${{ inputs.branch }}
|
||||
major_version: ${{ inputs.major_version }}
|
||||
version: ${{ inputs.version }}
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
with:
|
||||
framework: ${{ inputs.framework }}
|
||||
runtime: ${{ matrix.runtime }}
|
||||
artifact: build-${{ matrix.runtime }}
|
||||
branch: ${{ inputs.branch }}
|
||||
major_version: ${{ inputs.major_version }}
|
||||
version: ${{ inputs.version }}
|
||||
|
||||
release:
|
||||
needs: package
|
||||
@@ -59,102 +70,102 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download release artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: _artifacts
|
||||
pattern: release_*
|
||||
merge-multiple: true
|
||||
- name: Download release artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: _artifacts
|
||||
pattern: release-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Get Previous Release
|
||||
id: previous-release
|
||||
uses: cardinalby/git-get-release-action@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
latest: true
|
||||
prerelease: ${{ inputs.branch != 'main' }}
|
||||
- name: Get Previous Release
|
||||
id: previous-release
|
||||
uses: cardinalby/git-get-release-action@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
latest: true
|
||||
prerelease: ${{ inputs.branch != 'main' }}
|
||||
|
||||
- name: Generate Release Notes
|
||||
id: generate-release-notes
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
result-encoding: string
|
||||
script: |
|
||||
const { data } = await github.rest.repos.generateReleaseNotes({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
tag_name: 'v${{ inputs.version }}',
|
||||
target_commitish: '${{ github.sha }}',
|
||||
previous_tag_name: '${{ steps.previous-release.outputs.tag_name }}',
|
||||
})
|
||||
return data.body
|
||||
- name: Generate Release Notes
|
||||
id: generate-release-notes
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
result-encoding: string
|
||||
script: |
|
||||
const { data } = await github.rest.repos.generateReleaseNotes({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
tag_name: 'v${{ inputs.version }}',
|
||||
target_commitish: '${{ github.sha }}',
|
||||
previous_tag_name: '${{ steps.previous-release.outputs.tag_name }}',
|
||||
})
|
||||
return data.body
|
||||
|
||||
- name: Create release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: _artifacts/Sonarr.*
|
||||
commit: ${{ github.sha }}
|
||||
generateReleaseNotes: false
|
||||
body: ${{ steps.generate-release-notes.outputs.result }}
|
||||
name: ${{ inputs.version }}
|
||||
prerelease: ${{ inputs.branch != 'main' }}
|
||||
skipIfReleaseExists: true
|
||||
tag: v${{ inputs.version }}
|
||||
- name: Create release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: _artifacts/Sonarr.*
|
||||
commit: ${{ github.sha }}
|
||||
generateReleaseNotes: false
|
||||
body: ${{ steps.generate-release-notes.outputs.result }}
|
||||
name: ${{ inputs.version }}
|
||||
prerelease: ${{ inputs.branch != 'main' }}
|
||||
skipIfReleaseExists: true
|
||||
tag: v${{ inputs.version }}
|
||||
|
||||
- name: Publish to Services
|
||||
shell: bash
|
||||
working-directory: _artifacts
|
||||
run: |
|
||||
branch=${{ inputs.branch }}
|
||||
version=${{ inputs.version }}
|
||||
lastCommit=${{ github.sha }}
|
||||
|
||||
hashes="["
|
||||
|
||||
addHash() {
|
||||
path=$1
|
||||
os=$2
|
||||
arch=$3
|
||||
type=$4
|
||||
|
||||
local hash=$(sha256sum *.$version.$path | awk '{ print $1; }')
|
||||
echo "{ \""Os\"": \""$os\"", \""Arch\"": \""$arch\"", \""Type\"": \""$type\"", \""Hash\"": \""$hash\"" }"
|
||||
}
|
||||
|
||||
hashes="$hashes $(addHash "linux-arm.tar.gz" "linux" "arm" "archive")"
|
||||
hashes="$hashes, $(addHash "linux-arm64.tar.gz" "linux" "arm64" "archive")"
|
||||
hashes="$hashes, $(addHash "linux-x64.tar.gz" "linux" "x64" "archive")"
|
||||
# hashes="$hashes, $(addHash "linux-x86.tar.gz" "linux" "x86" "archive")"
|
||||
|
||||
# hashes="$hashes, $(addHash "linux-musl-arm.tar.gz" "linuxmusl" "arm" "archive")"
|
||||
hashes="$hashes, $(addHash "linux-musl-arm64.tar.gz" "linuxmusl" "arm64" "archive")"
|
||||
hashes="$hashes, $(addHash "linux-musl-x64.tar.gz" "linuxmusl" "x64" "archive")"
|
||||
|
||||
hashes="$hashes, $(addHash "osx-arm64.tar.gz" "osx" "arm64" "archive")"
|
||||
hashes="$hashes, $(addHash "osx-x64.tar.gz" "osx" "x64" "archive")"
|
||||
|
||||
hashes="$hashes, $(addHash "osx-arm64-app.zip" "osx" "arm64" "installer")"
|
||||
hashes="$hashes, $(addHash "osx-x64-app.zip" "osx" "x64" "installer")"
|
||||
|
||||
hashes="$hashes, $(addHash "win-x64.zip" "windows" "x64" "archive")"
|
||||
hashes="$hashes, $(addHash "win-x86.zip" "windows" "x86" "archive")"
|
||||
|
||||
hashes="$hashes, $(addHash "win-x64-installer.exe" "windows" "x64" "installer")"
|
||||
hashes="$hashes, $(addHash "win-x86-installer.exe" "windows" "x86" "installer")"
|
||||
|
||||
hashes="$hashes, $(addHash "freebsd-x64.tar.gz" "freebsd" "x64" "archive")"
|
||||
|
||||
hashes="$hashes ]"
|
||||
|
||||
json="{\""branch\"":\""$branch\"", \""version\"":\""$version\"", \""lastCommit\"":\""$lastCommit\"", \""hashes\"":$hashes, \""gitHubRelease\"":true}"
|
||||
url="https://services.sonarr.tv/v1/update"
|
||||
|
||||
echo "Publishing update $version ($branch) to: $url"
|
||||
echo "$json"
|
||||
|
||||
curl -H "Content-Type: application/json" -H "X-Api-Key: ${{ secrets.SERVICES_API_KEY }}" -X POST -d "$json" --fail-with-body $url
|
||||
- name: Publish to Services
|
||||
shell: bash
|
||||
working-directory: _artifacts
|
||||
run: |
|
||||
branch=${{ inputs.branch }}
|
||||
version=${{ inputs.version }}
|
||||
lastCommit=${{ github.sha }}
|
||||
|
||||
hashes="["
|
||||
|
||||
addHash() {
|
||||
path=$1
|
||||
os=$2
|
||||
arch=$3
|
||||
type=$4
|
||||
|
||||
local hash=$(sha256sum *.$version.$path | awk '{ print $1; }')
|
||||
echo "{ \""Os\"": \""$os\"", \""Arch\"": \""$arch\"", \""Type\"": \""$type\"", \""Hash\"": \""$hash\"" }"
|
||||
}
|
||||
|
||||
hashes="$hashes $(addHash "linux-arm.tar.gz" "linux" "arm" "archive")"
|
||||
hashes="$hashes, $(addHash "linux-arm64.tar.gz" "linux" "arm64" "archive")"
|
||||
hashes="$hashes, $(addHash "linux-x64.tar.gz" "linux" "x64" "archive")"
|
||||
# hashes="$hashes, $(addHash "linux-x86.tar.gz" "linux" "x86" "archive")"
|
||||
|
||||
# hashes="$hashes, $(addHash "linux-musl-arm.tar.gz" "linuxmusl" "arm" "archive")"
|
||||
hashes="$hashes, $(addHash "linux-musl-arm64.tar.gz" "linuxmusl" "arm64" "archive")"
|
||||
hashes="$hashes, $(addHash "linux-musl-x64.tar.gz" "linuxmusl" "x64" "archive")"
|
||||
|
||||
hashes="$hashes, $(addHash "osx-arm64.tar.gz" "osx" "arm64" "archive")"
|
||||
hashes="$hashes, $(addHash "osx-x64.tar.gz" "osx" "x64" "archive")"
|
||||
|
||||
hashes="$hashes, $(addHash "osx-arm64-app.zip" "osx" "arm64" "installer")"
|
||||
hashes="$hashes, $(addHash "osx-x64-app.zip" "osx" "x64" "installer")"
|
||||
|
||||
hashes="$hashes, $(addHash "win-x64.zip" "windows" "x64" "archive")"
|
||||
hashes="$hashes, $(addHash "win-x86.zip" "windows" "x86" "archive")"
|
||||
|
||||
hashes="$hashes, $(addHash "win-x64-installer.exe" "windows" "x64" "installer")"
|
||||
hashes="$hashes, $(addHash "win-x86-installer.exe" "windows" "x86" "installer")"
|
||||
|
||||
hashes="$hashes, $(addHash "freebsd-x64.tar.gz" "freebsd" "x64" "archive")"
|
||||
|
||||
hashes="$hashes ]"
|
||||
|
||||
json="{\""branch\"":\""$branch\"", \""version\"":\""$version\"", \""lastCommit\"":\""$lastCommit\"", \""hashes\"":$hashes, \""gitHubRelease\"":true}"
|
||||
url="https://services.sonarr.tv/v1/update"
|
||||
|
||||
echo "Publishing update $version ($branch) to: $url"
|
||||
echo "$json"
|
||||
|
||||
curl -H "Content-Type: application/json" -H "X-Api-Key: ${{ secrets.SERVICES_API_KEY }}" -X POST -d "$json" --fail-with-body $url
|
||||
|
||||
Reference in New Issue
Block a user