aboutsummaryrefslogtreecommitdiff
path: root/build.py
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2024-03-06 20:54:47 -0500
committerGitHub <noreply@github.com>2024-03-06 20:54:47 -0500
commit06908a14c5a95a4c08cee99a534329e96ae25537 (patch)
treef59172df7bd57b6830c55ef981c564b05e76fee3 /build.py
parentMerge pull request #4 from Gauvino/master (diff)
parentAdd workflow to publish nuget packages (diff)
downloadjellyfin-packaging-06908a14c5a95a4c08cee99a534329e96ae25537.tar.gz
jellyfin-packaging-06908a14c5a95a4c08cee99a534329e96ae25537.tar.bz2
jellyfin-packaging-06908a14c5a95a4c08cee99a534329e96ae25537.zip
Merge pull request #5 from jellyfin-sandbox/publish-nuget
Add workflow to publish nuget packages
Diffstat (limited to 'build.py')
-rwxr-xr-xbuild.py50
1 files changed, 50 insertions, 0 deletions
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:
bgstack15