refactor: lightweight pack — bundle CMS only, link other repos via MANIFEST (URL+commit)
This commit is contained in:
1 parent
d675a842e8
commit
a6b708080c
1 file changed
+38
-184
+38
-184
@@ -25,6 +25,11 @@ jobs:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
FORCE: ${{ github.event.inputs.force }}
|
||||
CACHE_DIR: /var/tmp/pack-cache
|
||||
CMS_URL: ${{ gitea.server_url }}/${{ gitea.repository }}
|
||||
CAT_URL: https://gitlab.epicnabbo.nl/remco/Epicnabbo-Catalogus-Updated-Daily
|
||||
NITRO_URL: https://github.com/duckietm/Nitro-V3
|
||||
RENDER_URL: https://github.com/duckietm/Nitro_Render_V3
|
||||
EMU_URL: https://github.com/duckietm/Polaris-Emulator
|
||||
steps:
|
||||
- name: Check for upstream changes
|
||||
id: check
|
||||
@@ -56,7 +61,6 @@ jobs:
|
||||
echo "changed=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
echo "$COMBINED" > "$STATE"
|
||||
# Expose individual refs so later steps can compare per-component.
|
||||
echo "cms_ref=$CMS_REF" >> "$GITHUB_OUTPUT"
|
||||
echo "cat_ref=$CAT_REF" >> "$GITHUB_OUTPUT"
|
||||
echo "nitro_ref=$NITRO_REF" >> "$GITHUB_OUTPUT"
|
||||
@@ -81,197 +85,59 @@ jobs:
|
||||
echo "WORK=$WORK" >> "$GITHUB_ENV"
|
||||
echo "PACK_VERSION=$PACK_VERSION" >> "$GITHUB_ENV"
|
||||
|
||||
# ---- Per-component: pull only if ref changed, reuse cached build otherwise ----
|
||||
# ---- Only the CMS repo is bundled; the rest are linked ----
|
||||
- name: CMS (this repo)
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
run: |
|
||||
set -e
|
||||
S="$CACHE_DIR/cms"; mkdir -p "$S"
|
||||
BARE="/docker/gitea/gitea/git/repositories/remco/epicnext-cms.git"
|
||||
if [ "${{ steps.check.outputs.cms_ref }}" != "$(cat "$S/ref" 2>/dev/null)" ]; then
|
||||
rm -rf "$WORK/src/cms"
|
||||
git clone --depth 1 "file://$BARE" "$WORK/src/cms" 2>/dev/null \
|
||||
git clone --depth 1 "file:///docker/gitea/gitea/git/repositories/remco/epicnext-cms.git" "$WORK/src/cms" 2>/dev/null \
|
||||
|| git clone --depth 1 "${{ gitea.server_url }}/${{ gitea.repository }}.git" "$WORK/src/cms" 2>/dev/null \
|
||||
|| git -C "$WORK/src/cms" pull --ff-only 2>/dev/null
|
||||
echo "${{ steps.check.outputs.cms_ref }}" > "$S/ref"
|
||||
rm -rf "$S/snapshot"; cp -r "$WORK/src/cms" "$S/snapshot"
|
||||
CMS_ST="new"
|
||||
else
|
||||
cp -r "$S/snapshot" "$WORK/src/cms"
|
||||
echo "CMS unchanged — reused cache"
|
||||
CMS_ST="cached"
|
||||
fi
|
||||
echo "cms:$CMS_ST" >> "$WORK/status.txt"
|
||||
echo "cms: $(git -C "$WORK/src/cms" rev-parse --short HEAD 2>/dev/null)" | tee -a "$WORK/components.txt"
|
||||
|
||||
- name: Catalogus (sparse)
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
run: |
|
||||
set -e
|
||||
S="$CACHE_DIR/catalogus"; mkdir -p "$S"
|
||||
if [ "${{ steps.check.outputs.cat_ref }}" != "$(cat "$S/ref" 2>/dev/null)" ]; then
|
||||
rm -rf "$WORK/src/catalogus"
|
||||
for attempt in 1 2 3; do
|
||||
if git clone --depth 1 \
|
||||
https://gitlab.epicnabbo.nl/remco/Epicnabbo-Catalogus-Updated-Daily.git "$WORK/src/catalogus" 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
echo "Catalogus clone attempt $attempt failed, retrying..." >&2
|
||||
sleep 5
|
||||
done
|
||||
[ -f "$WORK/src/catalogus/readme.md" ] || { echo "Catalogus clone failed"; exit 1; }
|
||||
echo "${{ steps.check.outputs.cat_ref }}" > "$S/ref"
|
||||
rm -rf "$S/snapshot"; cp -r "$WORK/src/catalogus" "$S/snapshot"
|
||||
else
|
||||
cp -r "$S/snapshot" "$WORK/src/catalogus"
|
||||
echo "Catalogus unchanged — reused cache"
|
||||
CAT_ST="cached"
|
||||
fi
|
||||
[ -z "$CAT_ST" ] && CAT_ST="new"
|
||||
echo "catalogus:$CAT_ST" >> "$WORK/status.txt"
|
||||
echo "catalogus: $(git -C "$WORK/src/catalogus" rev-parse --short HEAD 2>/dev/null)" | tee -a "$WORK/components.txt"
|
||||
|
||||
- name: Nitro-Render-V3
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
run: |
|
||||
set -e
|
||||
S="$CACHE_DIR/render"; mkdir -p "$S"
|
||||
# Nitro-V3's vite.config expects the renderer at ../Nitro_Render_V3
|
||||
RENDER_DIR="$WORK/src/Nitro_Render_V3"
|
||||
if [ "${{ steps.check.outputs.render_ref }}" != "$(cat "$S/ref" 2>/dev/null)" ]; then
|
||||
rm -rf "$RENDER_DIR"
|
||||
for attempt in 1 2 3; do
|
||||
if git clone --depth 1 https://github.com/duckietm/Nitro_Render_V3.git "$RENDER_DIR" 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
echo "Render clone attempt $attempt failed, retrying..." >&2
|
||||
sleep 5
|
||||
done
|
||||
[ -f "$RENDER_DIR/package.json" ] || { echo "Render clone failed"; exit 1; }
|
||||
cd "$RENDER_DIR"
|
||||
yarn install --frozen-lockfile --prefer-offline 2>&1 || yarn install 2>&1
|
||||
rm -rf "$S/files"; mkdir -p "$S/files"; cp -r . "$S/files/" 2>/dev/null || true
|
||||
rm -rf "$S/files/node_modules"
|
||||
echo "${{ steps.check.outputs.render_ref }}" > "$S/ref"
|
||||
REN_ST="new"
|
||||
else
|
||||
echo "Render unchanged — reused cache"
|
||||
rm -rf "$RENDER_DIR"; mkdir -p "$RENDER_DIR"; cp -r "$S/files/"* "$RENDER_DIR/" 2>/dev/null || true
|
||||
REN_ST="cached"
|
||||
fi
|
||||
[ -z "$REN_ST" ] && REN_ST="new"
|
||||
echo "render:$REN_ST" >> "$WORK/status.txt"
|
||||
mkdir -p "$WORK/out/render"; cp -r "$S/files/"* "$WORK/out/render/" 2>/dev/null || true
|
||||
echo "render: $(git -C "$RENDER_DIR" rev-parse --short HEAD 2>/dev/null || echo cached)" | tee -a "$WORK/components.txt"
|
||||
|
||||
- name: Nitro-V3
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
run: |
|
||||
set -e
|
||||
S="$CACHE_DIR/nitro"; mkdir -p "$S"
|
||||
if [ "${{ steps.check.outputs.nitro_ref }}" != "$(cat "$S/ref" 2>/dev/null)" ]; then
|
||||
rm -rf "$WORK/src/nitro"
|
||||
for attempt in 1 2 3; do
|
||||
if git clone --depth 1 https://github.com/duckietm/Nitro-V3.git "$WORK/src/nitro" 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
echo "Nitro clone attempt $attempt failed, retrying..." >&2
|
||||
sleep 5
|
||||
done
|
||||
[ -f "$WORK/src/nitro/package.json" ] || { echo "Nitro clone failed"; exit 1; }
|
||||
cd "$WORK/src/nitro"
|
||||
yarn install --frozen-lockfile --prefer-offline 2>&1 || yarn install 2>&1
|
||||
yarn build
|
||||
rm -rf "$S/dist"; mkdir -p "$S/dist"; cp -r dist/* "$S/dist/" 2>/dev/null || true
|
||||
echo "${{ steps.check.outputs.nitro_ref }}" > "$S/ref"
|
||||
NIT_ST="new"
|
||||
else
|
||||
echo "Nitro unchanged — reused cached dist"
|
||||
NIT_ST="cached"
|
||||
fi
|
||||
[ -z "$NIT_ST" ] && NIT_ST="new"
|
||||
echo "nitro:$NIT_ST" >> "$WORK/status.txt"
|
||||
mkdir -p "$WORK/out/nitro"; cp -r "$S/dist/"* "$WORK/out/nitro/" 2>/dev/null || true
|
||||
echo "nitro: $(git -C "$WORK/src/nitro" rev-parse --short HEAD 2>/dev/null || echo cached)" | tee -a "$WORK/components.txt"
|
||||
|
||||
- name: Polaris Emulator
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
run: |
|
||||
set -e
|
||||
S="$CACHE_DIR/emulator"; mkdir -p "$S"
|
||||
if [ "${{ steps.check.outputs.emu_ref }}" != "$(cat "$S/ref" 2>/dev/null)" ]; then
|
||||
rm -rf "$WORK/src/emulator"
|
||||
for attempt in 1 2 3; do
|
||||
if git clone --depth 1 https://github.com/duckietm/Polaris-Emulator.git "$WORK/src/emulator" 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
echo "Emulator clone attempt $attempt failed, retrying..." >&2
|
||||
sleep 5
|
||||
done
|
||||
[ -f "$WORK/src/emulator/Emulator/pom.xml" ] || { echo "Emulator clone failed (no pom.xml)"; exit 1; }
|
||||
cd "$WORK/src/emulator/Emulator"
|
||||
mvn package -q -T 1C -o -Dmaven.test.skip=true 2>&1 \
|
||||
|| mvn package -q -T 1C -Dmaven.test.skip=true 2>&1
|
||||
rm -f "$S"/*.jar; find target -maxdepth 1 -name 'Polaris-*-jar-with-dependencies.jar' -exec cp {} "$S/" \; 2>/dev/null || true
|
||||
echo "${{ steps.check.outputs.emu_ref }}" > "$S/ref"
|
||||
EMU_ST="new"
|
||||
else
|
||||
echo "Emulator unchanged — reused cached jar"
|
||||
EMU_ST="cached"
|
||||
fi
|
||||
[ -z "$EMU_ST" ] && EMU_ST="new"
|
||||
echo "emulator:$EMU_ST" >> "$WORK/status.txt"
|
||||
mkdir -p "$WORK/out/emulator"; cp "$S"/*.jar "$WORK/out/emulator/" 2>/dev/null || true
|
||||
echo "emulator: $(git -C "$WORK/src/emulator" rev-parse --short HEAD 2>/dev/null || echo cached)" | tee -a "$WORK/components.txt"
|
||||
|
||||
- name: Assemble Pack
|
||||
- name: Assemble Pack (CMS + repo links)
|
||||
if: steps.check.outputs.changed == 'true'
|
||||
run: |
|
||||
set -e
|
||||
cd "$WORK/out"
|
||||
cp -r "$WORK/src/cms" "$WORK/out/cms" 2>/dev/null || true
|
||||
rm -rf "$WORK/out/cms/.git" "$WORK/out/cms/node_modules" 2>/dev/null || true
|
||||
cp -r "$WORK/src/catalogus" "$WORK/out/catalogus" 2>/dev/null || true
|
||||
rm -rf "$WORK/out/catalogus/.git" 2>/dev/null || true
|
||||
# Diagnostics: show each component size before packing.
|
||||
for d in cms catalogus nitro render emulator; do
|
||||
echo "out/$d: $(du -sh "$WORK/out/$d" 2>/dev/null | cut -f1) ($(find "$WORK/out/$d" -type f 2>/dev/null | wc -l) files)"
|
||||
done
|
||||
# Hard guard: every component must be present and non-empty.
|
||||
for d in catalogus nitro render emulator; do
|
||||
if [ ! -d "$WORK/out/$d" ] || [ -z "$(find "$WORK/out/$d" -type f 2>/dev/null | head -1)" ]; then
|
||||
echo "ERROR: component '$d' is missing or empty in the pack"; exit 1
|
||||
fi
|
||||
done
|
||||
cp "$WORK/components.txt" "$WORK/out/COMPONENTS.txt"
|
||||
# Build a clear, human-readable manifest at the pack root.
|
||||
short() { echo "$1" | cut -c1-8; }
|
||||
{
|
||||
echo "# Site Pack ${PACK_VERSION}"
|
||||
echo ""
|
||||
echo "Generated: $(date -u)"
|
||||
echo ""
|
||||
echo "## Contents"
|
||||
echo "This pack bundles the **EpicNext-CMS** source. The other components are linked below at the exact commit used."
|
||||
echo ""
|
||||
echo "| Component | Path | Version | Status |"
|
||||
echo "|-----------|------|---------|--------|"
|
||||
for pair in "CMS:cms:cms" "Catalogus:catalogus:catalogus" "Nitro-V3:nitro:nitro" "Nitro-Render-V3:render:render" "Polaris Emulator:emulator:emulator"; do
|
||||
label="${pair%%:*}"; d="${pair#*:}"; key="${pair##*:}"
|
||||
ver="$(grep -m1 "^${key}: " "$WORK/components.txt" 2>/dev/null | cut -d' ' -f2- | tr -d ' ')"
|
||||
st="$(grep -m1 "^${key}:" "$WORK/status.txt" 2>/dev/null | cut -d: -f2- | tr -d ' ')"
|
||||
[ -z "$st" ] && st="new"
|
||||
echo "| ${label} | ${d}/ | ${ver:-?} | ${st} |"
|
||||
done
|
||||
echo "## Bundled"
|
||||
echo ""
|
||||
echo "## Structure"
|
||||
echo "- \`cms/\` — EpicNext-CMS (this repository)"
|
||||
echo ""
|
||||
echo "## Linked repositories (exact commits)"
|
||||
echo ""
|
||||
echo "| Component | Repository | Commit |"
|
||||
echo "|-----------|------------|--------|"
|
||||
echo "| Catalogus | ${CAT_URL} | $(short "${{ steps.check.outputs.cat_ref }}") |"
|
||||
echo "| Nitro-V3 | ${NITRO_URL} | $(short "${{ steps.check.outputs.nitro_ref }}") |"
|
||||
echo "| Nitro-Render-V3 | ${RENDER_URL} | $(short "${{ steps.check.outputs.render_ref }}") |"
|
||||
echo "| Polaris Emulator | ${EMU_URL} | $(short "${{ steps.check.outputs.emu_ref }}") |"
|
||||
echo ""
|
||||
echo "Clone a component at its pinned commit:"
|
||||
echo '```'
|
||||
echo "pack/"
|
||||
echo "├── cms/ # EpicNext-CMS (this repo)"
|
||||
echo "├── catalogus/ # Epicnabbo-Catalogus-Updated-Daily"
|
||||
echo "├── nitro/ # Nitro-V3 client build (dist)"
|
||||
echo "├── render/ # Nitro-Render-V3"
|
||||
echo "├── emulator/ # Polaris Emulator jar"
|
||||
echo "├── MANIFEST.md # this file"
|
||||
echo "└── COMPONENTS.txt # raw versions"
|
||||
echo "git clone ${CAT_URL} && (cd Epicnabbo-Catalogus-Updated-Daily && git checkout ${{ steps.check.outputs.cat_ref }})"
|
||||
echo "git clone ${NITRO_URL} && (cd Nitro-V3 && git checkout ${{ steps.check.outputs.nitro_ref }})"
|
||||
echo "git clone ${RENDER_URL} && (cd Nitro_Render_V3 && git checkout ${{ steps.check.outputs.render_ref }})"
|
||||
echo "git clone ${EMU_URL} && (cd Polaris-Emulator && git checkout ${{ steps.check.outputs.emu_ref }})"
|
||||
echo '```'
|
||||
} > "$WORK/out/MANIFEST.md"
|
||||
cp "$WORK/out/MANIFEST.md" "$WORK/out/COMPONENTS.txt"
|
||||
@@ -292,26 +158,21 @@ jobs:
|
||||
{
|
||||
echo "## Site Pack ${PACK_VERSION}"
|
||||
echo ""
|
||||
echo "Complete pack with all components. See the attached \`MANIFEST.md\` in the download for exact per-component versions."
|
||||
echo "Lightweight pack: bundles the EpicNext-CMS source and links the other components at their exact commits."
|
||||
echo ""
|
||||
echo "### What's included (this pack)"
|
||||
echo "### Linked component commits"
|
||||
echo '```'
|
||||
while IFS= read -r line; do
|
||||
key="${line%%:*}"; rest="${line#*: }"
|
||||
st="$(grep "^${key}:" "$WORK/status.txt" 2>/dev/null | head -1 | cut -d: -f2- | tr -d ' ')"
|
||||
[ -z "$st" ] && st="new"
|
||||
printf "%-12s %s [%s]\n" "$key" "$rest" "$st"
|
||||
done < "$WORK/components.txt"
|
||||
echo "CMS (bundled): ${{ steps.check.outputs.cms_ref }}"
|
||||
echo "Catalogus: ${{ steps.check.outputs.cat_ref }}"
|
||||
echo "Nitro-V3: ${{ steps.check.outputs.nitro_ref }}"
|
||||
echo "Nitro-Render-V3: ${{ steps.check.outputs.render_ref }}"
|
||||
echo "Polaris Emulator: ${{ steps.check.outputs.emu_ref }}"
|
||||
echo '```'
|
||||
echo ""
|
||||
echo "### What's new since pack ${PREV_NOTE}"
|
||||
for pair in "cms:$WORK/src/cms" "catalogus:$WORK/src/catalogus" "nitro:$WORK/src/nitro" "render:$WORK/src/Nitro_Render_V3" "emulator:$WORK/src/emulator"; do
|
||||
label="${pair%%:*}"; repo="${pair##*:}"
|
||||
echo "**${label}**"
|
||||
echo '```'
|
||||
git -C "$repo" log --oneline --no-decorate -10 2>/dev/null || echo "n/a"
|
||||
echo '```'
|
||||
done
|
||||
echo "### CMS changes since pack ${PREV_NOTE}"
|
||||
echo '```'
|
||||
git -C "$WORK/src/cms" log --oneline --no-decorate -10 2>/dev/null || echo "n/a"
|
||||
echo '```'
|
||||
} > /tmp/pack-body.md
|
||||
cat /tmp/pack-body.md
|
||||
|
||||
@@ -324,15 +185,8 @@ jobs:
|
||||
: "${GITEA_REPO:?GITEA_REPO not set}"
|
||||
T="${TOKEN:-${GITEA_TOKEN}}"
|
||||
[ -n "$T" ] || { echo "No token available"; exit 1; }
|
||||
# Diagnostics: surface exactly what the runner resolves.
|
||||
echo "GITEA_API=[${GITEA_API}]"
|
||||
echo "GITEA_REPO=[${GITEA_REPO}]"
|
||||
echo "pack-body.md bytes: $(wc -c < /tmp/pack-body.md 2>/dev/null || echo MISSING)"
|
||||
echo "pack-body.md last bytes (xxd):"; tail -c 40 /tmp/pack-body.md 2>/dev/null | xxd | tail -3
|
||||
BODY="$(jq -Rs '.' < /tmp/pack-body.md)"
|
||||
PAYLOAD="$(jq -n --arg tag "${PACK_VERSION}" --arg name "${PACK_VERSION}" --arg body "$BODY" '{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')"
|
||||
echo "PAYLOAD bytes: ${#PAYLOAD}"
|
||||
echo "PAYLOAD head:"; echo "$PAYLOAD" | head -c 200; echo
|
||||
echo "Creating release via ${GITEA_API}/repos/${GITEA_REPO}/releases"
|
||||
HTTP="$(curl -s -w '%{http_code}' -o /tmp/pack-rel.json \
|
||||
--retry 3 --retry-delay 3 \
|
||||
|
||||
Reference in new issue
Block a user