Lint / Shell (shellcheck) (push) Successful in 14s
Lint / JS (eslint) (push) Successful in 11s
Lint / No secrets in webhook configs (push) Successful in 5s
Lint / Landing page is rendered (matrix (push) Successful in 4s
Lint / Python (ruff) (push) Successful in 6s
Lint / Python deps (pip-audit) (push) Successful in 32s
Lint / Secret scan (gitleaks) (push) Successful in 4s
Lint / Shell (shellcheck) (pull_request) Successful in 7s
Lint / JS (eslint) (pull_request) Successful in 5s
Lint / No secrets in webhook configs (pull_request) Successful in 4s
Lint / Landing page is rendered (matrix (pull_request) Successful in 3s
Lint / Python (ruff) (pull_request) Successful in 4s
Lint / Python deps (pip-audit) (pull_request) Successful in 30s
Lint / Secret scan (gitleaks) (pull_request) Successful in 4s
Decorations came through Nextcloud's public DAV: a new PHP session (four cookies) per image and no cache headers, on every decorated avatar. The set (629 decorations + thumbnails, 573 MB) is now a versioned Gitea generic package (avatar-decorations 1.0.0, 4 tar parts), pinned by sha256 in cinny/decorations.sha256. LXC 106's deploy installs it to /var/www/decorations-<version> (verified against the pin and the in-package manifest; previous version kept; failures leave the live set alone), and nginx serves /decorations/ with a one-week public cache. deploy/publish-decorations.sh publishes a new version and writes the pin. Fixes #22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
57 lines
2.6 KiB
Bash
Executable File
57 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Publish a new avatar-decorations version to the Gitea generic package
|
|
# registry and write the pin that LXC 106's deploy installs (matrix #22).
|
|
#
|
|
# GITEA_TOKEN=… deploy/publish-decorations.sh <dir> <version>
|
|
#
|
|
# <dir> holds <slug>.png files and thumbs/<slug>.webp (the same layout the app
|
|
# requests). The set is split into ≤150 MB tar parts (the registry's proxy
|
|
# refuses large uploads), each part is uploaded, and cinny/decorations.sha256
|
|
# is rewritten. Commit that file to deploy; nothing changes until you do.
|
|
set -euo pipefail
|
|
SRC=${1:?usage: publish-decorations.sh <dir> <version>}
|
|
VER=${2:?usage: publish-decorations.sh <dir> <version>}
|
|
: "${GITEA_TOKEN:?set GITEA_TOKEN (package write scope)}"
|
|
REPO_ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
|
BASE="https://code.lotusguild.org/api/packages/LotusGuild/generic/avatar-decorations/$VER"
|
|
WORK=$(mktemp -d)
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
mkdir -p "$WORK/decorations/thumbs"
|
|
cp "$SRC"/*.png "$WORK/decorations/"
|
|
cp "$SRC"/thumbs/*.webp "$WORK/decorations/thumbs/"
|
|
cd "$WORK"
|
|
for f in decorations/*.png; do
|
|
s=$(basename "$f" .png)
|
|
[ -f "decorations/thumbs/$s.webp" ] || { echo "missing thumbs/$s.webp" >&2; exit 1; }
|
|
done
|
|
(cd decorations && find . -type f \( -name '*.png' -o -name '*.webp' \) | sort | xargs sha256sum > MANIFEST.sha256)
|
|
|
|
python3 - "$VER" <<'PY'
|
|
import os, subprocess, sys
|
|
ver, root, limit = sys.argv[1], 'decorations', 150 * 1024 * 1024
|
|
files = sorted(os.path.join(root, f) for f in os.listdir(root) if f.endswith('.png'))
|
|
first = [os.path.join(root, 'MANIFEST.sha256')] + sorted(os.path.join(root, 'thumbs', t) for t in os.listdir(os.path.join(root, 'thumbs')))
|
|
parts, cur, size = [], list(first), sum(os.path.getsize(f) for f in first)
|
|
for f in files:
|
|
if size + os.path.getsize(f) > limit and cur:
|
|
parts.append(cur); cur, size = [], 0
|
|
cur.append(f); size += os.path.getsize(f)
|
|
parts.append(cur)
|
|
for i, p in enumerate(parts, 1):
|
|
lst = f'part{i}.list'
|
|
open(lst, 'w').write('\n'.join(p) + '\n')
|
|
subprocess.run(['tar', '--sort=name', '--owner=0', '--group=0', '--mtime=@0', '-cf',
|
|
f'avatar-decorations-{ver}.part{i}.tar', '-T', lst], check=True)
|
|
PY
|
|
|
|
sha256sum avatar-decorations-"$VER".part*.tar > SHA256SUMS
|
|
for f in avatar-decorations-"$VER".part*.tar SHA256SUMS; do
|
|
code=$(curl -s -o /dev/null -w '%{http_code}' -X PUT -H "Authorization: token $GITEA_TOKEN" \
|
|
--upload-file "$f" "$BASE/$f")
|
|
[ "$code" = 201 ] || { echo "upload of $f failed: HTTP $code" >&2; exit 1; }
|
|
echo "uploaded $f"
|
|
done
|
|
cp SHA256SUMS "$REPO_ROOT/cinny/decorations.sha256"
|
|
echo "Pinned $VER in cinny/decorations.sha256: commit it to deploy."
|