GPL-3.0-or-later, Gitea CI and release pipeline
- License the project under GPL-3.0-or-later (LICENSE + SPDX headers). - CI workflow builds every push and pull request and checks manifest.json. - Release workflow: an annotated v* tag builds that version, creates a Gitea release with the zip attached and adds it to manifest.json. - Release zips now live in Gitea releases instead of dist/; build.sh is a local test build only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d456442e6
commit
7398e590e6
15 files changed
+823
-55
No files matched your search
@@ -1,52 +1,12 @@
|
||||
#!/bin/sh
|
||||
# Release a new plugin version: ./build.sh 1.0.3.0 "What changed"
|
||||
# Builds in the official .NET 10 SDK container (only Docker is needed), writes
|
||||
# dist/lightsofftimer_<version>.zip and adds that version to manifest.json.
|
||||
# Local test build (releases are made by the Gitea pipeline from version tags):
|
||||
# ./build.sh -> out/lightsofftimer_dev.zip
|
||||
# Needs only Docker; builds in the official .NET 10 SDK image.
|
||||
set -eu
|
||||
VERSION=${1:?usage: ./build.sh <version, e.g. 1.0.3.0> "<changelog>"}
|
||||
CHANGELOG=${2:-}
|
||||
TARGET_ABI=${TARGET_ABI:-12.2.0.0}
|
||||
RAW_BASE=${RAW_BASE:-https://git.piskot.si/nikrozman/jellyfin-lights-out-ha/raw/branch/master}
|
||||
PROJ=src/Jellyfin.Plugin.LightsOffTimer/Jellyfin.Plugin.LightsOffTimer.csproj
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
sed -i.bak -E "s#<(Assembly|File)Version>[^<]+#<\1Version>$VERSION#g" "$PROJ" && rm -f "$PROJ.bak"
|
||||
rm -rf .build src/Jellyfin.Plugin.LightsOffTimer/bin src/Jellyfin.Plugin.LightsOffTimer/obj
|
||||
|
||||
rm -rf out src/Jellyfin.Plugin.LightsOffTimer/bin src/Jellyfin.Plugin.LightsOffTimer/obj
|
||||
docker run --rm --user "$(id -u):$(id -g)" -e HOME=/tmp -e DOTNET_CLI_HOME=/tmp -e DOTNET_NOLOGO=1 \
|
||||
-v "$PWD":/repo -w /repo mcr.microsoft.com/dotnet/sdk:10.0 \
|
||||
dotnet publish "$PROJ" -c Release -o /repo/.build
|
||||
|
||||
python3 - "$VERSION" "$CHANGELOG" "$TARGET_ABI" "$RAW_BASE" <<'PY'
|
||||
import datetime, hashlib, json, pathlib, sys, zipfile
|
||||
version, changelog, abi, raw = sys.argv[1:5]
|
||||
dist = pathlib.Path("dist"); dist.mkdir(exist_ok=True)
|
||||
zip_name = f"lightsofftimer_{version}.zip"
|
||||
with zipfile.ZipFile(dist / zip_name, "w", zipfile.ZIP_DEFLATED) as z:
|
||||
z.write(".build/Jellyfin.Plugin.LightsOffTimer.dll", "Jellyfin.Plugin.LightsOffTimer.dll")
|
||||
md5 = hashlib.md5((dist / zip_name).read_bytes()).hexdigest()
|
||||
|
||||
path = pathlib.Path("manifest.json")
|
||||
manifest = json.loads(path.read_text()) if path.exists() else [{
|
||||
"guid": "6b1c3f0e-6f2a-4c55-9d1e-4a7e2c9b5d31",
|
||||
"name": "Lights Off Timer",
|
||||
"description": "Sleep timer next to the volume control in the web player (default: end of this episode/movie). When playback stops, Home Assistant turns the lights off after a cooldown.",
|
||||
"overview": "Sleep timer + Home Assistant lights off",
|
||||
"owner": "nikrozman",
|
||||
"category": "General",
|
||||
"versions": [],
|
||||
}]
|
||||
plugin = manifest[0]
|
||||
plugin["versions"] = [v for v in plugin["versions"] if v["version"] != version]
|
||||
plugin["versions"].insert(0, {
|
||||
"version": version,
|
||||
"changelog": changelog,
|
||||
"targetAbi": abi,
|
||||
"sourceUrl": f"{raw}/dist/{zip_name}",
|
||||
"checksum": md5,
|
||||
"timestamp": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
|
||||
})
|
||||
path.write_text(json.dumps(manifest, indent=2) + "\n")
|
||||
print(f"dist/{zip_name} md5 {md5} (targetAbi {abi})")
|
||||
PY
|
||||
rm -rf .build
|
||||
dotnet publish src/Jellyfin.Plugin.LightsOffTimer/Jellyfin.Plugin.LightsOffTimer.csproj -c Release -o /repo/out
|
||||
(cd out && python3 -c "import zipfile; zipfile.ZipFile('lightsofftimer_dev.zip', 'w', zipfile.ZIP_DEFLATED).write('Jellyfin.Plugin.LightsOffTimer.dll')")
|
||||
echo "out/lightsofftimer_dev.zip"
|
||||
Reference in new issue
Block a user