From a0bfacaf29055a7106c00832958ba4c906b316e3 Mon Sep 17 00:00:00 2001 From: Waozi Date: Fri, 20 Nov 2026 01:01:00 -0300 Subject: [PATCH] Fetch only the website audio from Gitea LFS --- .gitea/workflows/pages.yml | 6 +++++- site/fetch-meditation-audio.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 site/fetch-meditation-audio.sh diff --git a/.gitea/workflows/pages.yml b/.gitea/workflows/pages.yml index 4036662fa..eb3bbfc53 100644 --- a/.gitea/workflows/pages.yml +++ b/.gitea/workflows/pages.yml @@ -23,10 +23,14 @@ jobs: steps: - name: Check out Breeze from Gitea uses: https://github.com/actions/checkout@v4 + env: + GIT_LFS_SKIP_SMUDGE: '1' with: - lfs: true persist-credentials: false + - name: Fetch the website's audio from Gitea LFS + run: sh site/fetch-meditation-audio.sh + - name: Set up Node.js uses: https://github.com/actions/setup-node@v4 with: diff --git a/site/fetch-meditation-audio.sh b/site/fetch-meditation-audio.sh new file mode 100644 index 000000000..43ec04507 --- /dev/null +++ b/site/fetch-meditation-audio.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -eu +cd "$(dirname "$0")/.." + +# Pages needs the three meditation tracks. The published app bundle already +# contains its own assets, so no native or design LFS objects are needed here. +sources=$(git ls-files -- 'unpackaged_assets/audio/*.ogg') +test -n "$sources" +printf '%s\n' "$sources" | while IFS= read -r audio; do + test -f "$audio" + if [ "$(head -c 4 "$audio")" = OggS ]; then + continue + fi + git lfs pointer --check --file="$audio" + oid=$(sed -n 's/^oid sha256://p' "$audio") + size=$(sed -n 's/^size //p' "$audio") + download=$(mktemp "$audio.XXXXXX") + trap 'rm -f "$download"' 0 + curl -fsSL --max-time 120 --retry 2 \ + "https://git.waozi.xyz/waozi/breeze.git/info/lfs/objects/$oid" -o "$download" + test "$(wc -c < "$download")" -eq "$size" + printf '%s %s\n' "$oid" "$download" | sha256sum --check --status + test "$(head -c 4 "$download")" = OggS + chmod 644 "$download" + mv -f "$download" "$audio" + trap - 0 + printf 'Verified %s from Gitea LFS\n' "$audio" +done