jellyfin-packaging/portable/build.sh

63 lines
1.3 KiB
Bash
Raw Normal View History

2024-02-11 19:21:47 +00:00
#!/bin/bash
2024-02-11 21:47:03 +00:00
#= Generic portable builder (portable, linux, macos, windows)
2024-02-11 19:21:47 +00:00
set -o errexit
set -o xtrace
# Create the intermediate build dir
BUILD_DIR="/build"
mkdir -p ${BUILD_DIR}
# Move to source directory
pushd "${SOURCE_DIR}"
# Build server
pushd jellyfin-server
2024-03-03 06:21:34 +00:00
case ${BUILD_TYPE} in
2024-02-11 21:47:03 +00:00
portable)
RUNTIME=""
APPHOST="-p:UseAppHost=false"
;;
*)
2024-02-15 06:23:51 +00:00
RUNTIME="--self-contained --runtime ${DOTNET_TYPE}-${DOTNET_ARCH}"
2024-02-11 21:47:03 +00:00
APPHOST="-p:UseAppHost=true"
;;
esac
dotnet publish Jellyfin.Server --configuration Release ${RUNTIME} --output ${BUILD_DIR}/ -p:DebugSymbols=false -p:DebugType=none ${APPHOST}
2024-02-11 19:21:47 +00:00
popd
# Build web
pushd jellyfin-web
npm ci --no-audit --unsafe-perm
npm run build:production
mv dist ${BUILD_DIR}/jellyfin-web
popd
mkdir -p "${ARTIFACT_DIR}/"
2024-02-15 06:23:51 +00:00
if [[ -n ${PACKAGE_ARCH} ]]; then
2024-03-03 06:46:51 +00:00
VERSION_SUFFIX="${JELLYFIN_VERSION}-${PACKAGE_ARCH}"
2024-02-15 05:54:10 +00:00
else
2024-03-03 06:46:51 +00:00
VERSION_SUFFIX="${JELLYFIN_VERSION}"
2024-02-15 05:54:10 +00:00
fi
2024-02-11 19:21:47 +00:00
pushd ${BUILD_DIR}
for ARCHIVE_TYPE in $( tr ',' '\n' <<<"${ARCHIVE_TYPES}" ); do
case ${ARCHIVE_TYPE} in
targz)
2024-02-15 05:54:10 +00:00
tar -czf "${ARTIFACT_DIR}"/jellyfin_${VERSION_SUFFIX}.tar.gz .
2024-02-11 19:21:47 +00:00
;;
zip)
2024-02-15 05:54:10 +00:00
zip -qr "${ARTIFACT_DIR}"/jellyfin_${VERSION_SUFFIX}.zip .
2024-02-11 19:21:47 +00:00
;;
esac
done
popd
# Clean up any lingering artifacts
make -f debian/rules clean
rm -rf ${BUILD_DIR}
popd