aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/release-build.yaml32
-rwxr-xr-xbuild.py50
-rw-r--r--build.yaml14
3 files changed, 96 insertions, 0 deletions
diff --git a/.github/workflows/release-build.yaml b/.github/workflows/release-build.yaml
index 3772b08..b5c37d5 100644
--- a/.github/workflows/release-build.yaml
+++ b/.github/workflows/release-build.yaml
@@ -489,3 +489,35 @@ jobs:
sudo rm ${BASEDIR}/latest || true
sudo ln -sf ${BASEDIR}/${{ env.JELLYFIN_RELEASE_TYPE }}/${{ env.JELLYFIN_VERSION }} ${BASEDIR}/latest || exit 1
fi
+
+ Nuget:
+ runs-on: ubuntu-22.04
+ steps:
+ - name: "Set dated version for unstable builds"
+ id: version
+ run: |-
+ if grep --silent --extended-regexp '^v[0-9]+' <<< "${{ inputs.version || 'master' }}"; then
+ echo "JELLYFIN_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
+ echo "JELLYFIN_RELEASE_TYPE=stable" >> $GITHUB_ENV
+ else
+ echo "JELLYFIN_VERSION=$(date +'%Y%m%d%H')" >> $GITHUB_ENV
+ echo "JELLYFIN_RELEASE_TYPE=unstable" >> $GITHUB_ENV
+ fi
+
+ - name: "Install dependencies"
+ run: |-
+ sudo apt-get install --yes python3-git python3-yaml
+
+ - name: "Checkout repository"
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+
+ - name: "Prepare repository"
+ run: |-
+ ./checkout.py ${{ inputs.version || 'master' }}
+
+ - name: "Run builder for Nuget"
+ env:
+ NUGET_STABLE_KEY: ${{ secrets.NUGET_STABLE_KEY }}
+ NUGET_UNSTABLE_KEY: ${{ secrets.NUGET_UNSTABLE_KEY }}
+ run: |-
+ sudo ./build.py ${{ env.JELLYFIN_VERSION }} nuget
diff --git a/build.py b/build.py
index ba10daf..6b6ee54 100755
--- a/build.py
+++ b/build.py
@@ -439,6 +439,55 @@ def build_docker(jellyfin_version, build_type, _build_arch, _build_version, no_p
# Log out of GHCR
os.system("docker logout")
+def build_nuget(jellyfin_version, build_type, _build_arch, _build_version, no_push=False):
+ """
+ Pack and upload nuget packages
+ """
+ log("> Building Nuget packages...")
+ log("")
+
+ project_files = configurations["nuget"]["projects"]
+ log(project_files)
+
+ # Determine if this is a "latest"-type image (v in jellyfin_version) or not
+ if "v" in jellyfin_version:
+ is_unstable = False
+ else:
+ is_unstable = True
+
+ jellyfin_version = jellyfin_version.replace("v", "")
+
+
+ # Set today's date in a convenient format for use as an image suffix
+ date = datetime.now().strftime("%Y%m%d%H%M%S")
+
+ pack_command = "dotnet pack -o out "
+ if is_unstable:
+ pack_command = pack_command + f"--version-suffix {date} -p:Stability=Unstable "
+ else:
+ pack_command = pack_command + f"-p:Version={jellyfin_version} "
+
+ for project in project_files:
+ log(f">> Packing {project}...")
+ log("")
+
+ project_pack_command = pack_command + f"jellyfin-server/{project}"
+ log(f">>>> {project_pack_command}")
+ os.system(project_pack_command)
+
+ if no_push:
+ return
+
+ if is_unstable:
+ nuget_repo = configurations["nuget"]["feed_urls"]["unstable"]
+ nuget_key = getenv('NUGET_UNSTABLE_KEY')
+ else:
+ nuget_repo = configurations["nuget"]["feed_urls"]["stable"]
+ nuget_key = getenv('NUGET_STABLE_KEY')
+
+ push_command = f"dotnet nuget push out/*.nupkg -s {nuget_repo} -k {nuget_key}"
+ log(f">>>> {push_command}")
+ os.system(push_command)
def usage():
"""
@@ -467,6 +516,7 @@ function_definitions = {
"build_macos": build_macos,
"build_portable": build_portable,
"build_docker": build_docker,
+ "build_nuget": build_nuget,
}
try:
diff --git a/build.yaml b/build.yaml
index e614c3c..5d32220 100644
--- a/build.yaml
+++ b/build.yaml
@@ -118,3 +118,17 @@ docker:
QEMU_ARCH: arm
dockerfile: docker/Dockerfile
imagename: jellyfin/jellyfin
+
+# Nuget packages
+nuget:
+ build_function: build_nuget
+ projects:
+ - Jellyfin.Data/Jellyfin.Data.csproj
+ - MediaBrowser.Common/MediaBrowser.Common.csproj
+ - MediaBrowser.Controller/MediaBrowser.Controller.csproj
+ - MediaBrowser.Model/MediaBrowser.Model.csproj
+ - Emby.Naming/Emby.Naming.csproj
+ - src/Jellyfin.Extensions/Jellyfin.Extensions.csproj
+ feed_urls:
+ stable: https://api.nuget.org/v3/index.json
+ unstable: https://nuget.pkg.github.com/jellyfin-sandbox/index.json
bgstack15