From d10331694507bc96b0ac447614e505fe69d214bf Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 20 Jul 2026 20:04:45 +0200 Subject: [PATCH] refactor: drop pack.yaml; v*-tag release now includes linked repo URLs + commits --- .gitea/workflows/deploy.yaml | 29 ++++- .gitea/workflows/pack.yaml | 210 ----------------------------------- 2 files changed, 27 insertions(+), 212 deletions(-) delete mode 100644 .gitea/workflows/pack.yaml diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 798975c0..0b34314d 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -30,9 +30,34 @@ jobs: fi [ -z "$CHANGELOG" ] && CHANGELOG="Initial release" - echo "${CHANGELOG}" > /tmp/changelog.txt + # Pin the other components at their current commits so the release is reproducible. + CAT_REF="$(git ls-remote https://gitlab.epicnabbo.nl/remco/Epicnabbo-Catalogus-Updated-Daily.git Beta-3 2>/dev/null | awk '{print $1}')" + NITRO_REF="$(git ls-remote https://github.com/duckietm/Nitro-V3.git main 2>/dev/null | awk '{print $1}')" + RENDER_REF="$(git ls-remote https://github.com/duckietm/Nitro_Render_V3.git main 2>/dev/null | awk '{print $1}')" + EMU_REF="$(git ls-remote https://github.com/duckietm/Polaris-Emulator.git main 2>/dev/null | awk '{print $1}')" - BODY="## EpicNext-CMS ${VERSION}"$'\n\n'"### Changes"$'\n'"${CHANGELOG}"$'\n\n---\n*Automated release from Gitea Actions*' + { + echo "## EpicNext-CMS ${VERSION}" + echo "" + echo "### Changes" + echo '```' + echo "${CHANGELOG}" + echo '```' + echo "" + echo "### Linked repositories (exact commits)" + echo "" + echo "| Component | Repository | Commit |" + echo "|-----------|------------|--------|" + echo "| Catalogus | https://gitlab.epicnabbo.nl/remco/Epicnabbo-Catalogus-Updated-Daily | ${CAT_REF:-?} |" + echo "| Nitro-V3 | https://github.com/duckietm/Nitro-V3 | ${NITRO_REF:-?} |" + echo "| Nitro-Render-V3 | https://github.com/duckietm/Nitro_Render_V3 | ${RENDER_REF:-?} |" + echo "| Polaris Emulator | https://github.com/duckietm/Polaris-Emulator | ${EMU_REF:-?} |" + echo "" + echo "---" + echo "*Automated release from Gitea Actions*" + } > /tmp/release-body.md + + BODY="$(jq -Rs '.' < /tmp/release-body.md)" PAYLOAD="$(printf '%s' "$BODY" | jq -Rs '{tag_name: $v, name: $v, body: ., draft: false, prerelease: false}' --arg v "${VERSION}")" diff --git a/.gitea/workflows/pack.yaml b/.gitea/workflows/pack.yaml deleted file mode 100644 index 4bc44fe4..00000000 --- a/.gitea/workflows/pack.yaml +++ /dev/null @@ -1,210 +0,0 @@ -name: Site Pack -on: - push: - branches: - - main - repository_dispatch: - types: - - build-pack - schedule: - # Poll all source repos every 15 minutes; rebuild only if a component changed. - - cron: "*/15 * * * *" - workflow_dispatch: - inputs: - force: - description: "Force rebuild even if nothing changed" - required: false - default: "false" - -jobs: - pack: - runs-on: shell - env: - GITEA_API: ${{ gitea.api_url }} - GITEA_REPO: ${{ gitea.repository }} - 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 - run: | - set -e - exec 2>&1 - CMS_REF="$(git -C /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git rev-parse main 2>/dev/null \ - || git ls-remote https://gitlab.epicnabbo.nl/remco/EpicNext-Cms.git main 2>/dev/null | awk '{print $1}')" - CAT_REF="$(git ls-remote https://gitlab.epicnabbo.nl/remco/Epicnabbo-Catalogus-Updated-Daily.git Beta-3 2>/dev/null | awk '{print $1}')" - NITRO_REF="$(git ls-remote https://github.com/duckietm/Nitro-V3.git main 2>/dev/null | awk '{print $1}')" - RENDER_REF="$(git ls-remote https://github.com/duckietm/Nitro_Render_V3.git main 2>/dev/null | awk '{print $1}')" - EMU_REF="$(git ls-remote https://github.com/duckietm/Polaris-Emulator.git main 2>/dev/null | awk '{print $1}')" - COMBINED="${CMS_REF}:${CAT_REF}:${NITRO_REF}:${RENDER_REF}:${EMU_REF}" - echo "Current refs: $COMBINED" - STATE="$CACHE_DIR/refs.state" - mkdir -p "$CACHE_DIR" - PREV="$(cat "$STATE" 2>/dev/null || echo "")" - CHANGED="" - if [ "${FORCE:-false}" = "true" ]; then - CHANGED="force" - elif [ "$COMBINED" != "$PREV" ]; then - CHANGED="upstream" - fi - if [ -n "$CHANGED" ]; then - echo "Change detected ($CHANGED)" - echo "changed=true" >> "$GITHUB_OUTPUT" - else - echo "No upstream changes since last pack" - echo "changed=false" >> "$GITHUB_OUTPUT" - fi - echo "$COMBINED" > "$STATE" - echo "cms_ref=$CMS_REF" >> "$GITHUB_OUTPUT" - echo "cat_ref=$CAT_REF" >> "$GITHUB_OUTPUT" - echo "nitro_ref=$NITRO_REF" >> "$GITHUB_OUTPUT" - echo "render_ref=$RENDER_REF" >> "$GITHUB_OUTPUT" - echo "emu_ref=$EMU_REF" >> "$GITHUB_OUTPUT" - - - name: Skip if unchanged - if: steps.check.outputs.changed != 'true' - run: | - echo "Nothing to rebuild. Exiting." - exit 0 - - - name: Setup - if: steps.check.outputs.changed == 'true' - run: | - set -e - exec 2>&1 - export PACK_VERSION="pack-$(date +%Y%m%d-%H%M)" - echo "=== Building site pack ${PACK_VERSION} ===" - WORK="/tmp/pack-build" - rm -rf "$WORK" && mkdir -p "$WORK/src" "$WORK/out" "$CACHE_DIR" - echo "WORK=$WORK" >> "$GITHUB_ENV" - echo "PACK_VERSION=$PACK_VERSION" >> "$GITHUB_ENV" - - # ---- 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" - if [ "${{ steps.check.outputs.cms_ref }}" != "$(cat "$S/ref" 2>/dev/null)" ]; then - rm -rf "$WORK/src/cms" - 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" - else - cp -r "$S/snapshot" "$WORK/src/cms" - echo "CMS unchanged — reused cache" - fi - echo "cms: $(git -C "$WORK/src/cms" rev-parse --short HEAD 2>/dev/null)" | tee -a "$WORK/components.txt" - - - 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 - short() { echo "$1" | cut -c1-8; } - { - echo "# Site Pack ${PACK_VERSION}" - echo "" - echo "Generated: $(date -u)" - echo "" - echo "This pack bundles the **EpicNext-CMS** source. The other components are linked below at the exact commit used." - echo "" - echo "## Bundled" - echo "" - 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 "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" - echo "Built at $(date -u)" > "$WORK/out/BUILD_INFO.txt" - cat "$WORK/components.txt" >> "$WORK/out/BUILD_INFO.txt" - PACK_FILE="/tmp/${PACK_VERSION}.tar.gz" - tar -czf "$PACK_FILE" -C "$WORK/out" . - echo "PACK_FILE=$PACK_FILE" >> "$GITHUB_ENV" - echo "Pack created: $(du -h "$PACK_FILE" | cut -f1)" - - - name: Build Changelog - if: steps.check.outputs.changed == 'true' - run: | - set -e - BARE="/docker/gitea/gitea/git/repositories/remco/epicnext-cms.git" - PREV="$(git -C "$BARE" tag --list 'pack-*' --sort=-creatordate | head -1 || echo '')" - PREV_NOTE="${PREV:-initial}" - { - echo "## Site Pack ${PACK_VERSION}" - echo "" - echo "Lightweight pack: bundles the EpicNext-CMS source and links the other components at their exact commits." - echo "" - echo "### Linked component commits" - echo '```' - 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 "### 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 - - - name: Create Release + Upload Pack - if: steps.check.outputs.changed == 'true' - run: | - set -e - : "${PACK_FILE:?PACK_FILE not set}" - : "${GITEA_API:?GITEA_API not set}" - : "${GITEA_REPO:?GITEA_REPO not set}" - T="${TOKEN:-${GITEA_TOKEN}}" - [ -n "$T" ] || { echo "No token available"; exit 1; } - 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 "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 \ - -X POST "${GITEA_API}/repos/${GITEA_REPO}/releases" \ - -H "Authorization: token ${T}" -H "Content-Type: application/json" -d "$PAYLOAD" || echo 000)" - echo "Create release HTTP: ${HTTP}" - cat /tmp/pack-rel.json | head -c 500; echo - if [ "${HTTP}" = "409" ]; then - REL_ID="$(curl -sf "${GITEA_API}/repos/${GITEA_REPO}/releases" -H "Authorization: token ${T}" | jq -r ".[] | select(.tag_name==\"${PACK_VERSION}\") | .id" || true)" - HTTP="$(curl -s -w '%{http_code}' -o /tmp/pack-rel.json -X PATCH "${GITEA_API}/repos/${GITEA_REPO}/releases/${REL_ID}" -H "Authorization: token ${T}" -H "Content-Type: application/json" -d "$PAYLOAD" || echo 000)" - echo "Patch release HTTP: ${HTTP}" - fi - REL_ID="$(jq -r '.id' /tmp/pack-rel.json 2>/dev/null || echo "")" - [ -n "$REL_ID" ] || { echo "No release ID from response"; exit 1; } - echo "Uploading asset to release ${REL_ID}" - UP="$(curl -s -w '%{http_code}' -o /tmp/pack-asset.json \ - -X POST "${GITEA_API}/repos/${GITEA_REPO}/releases/${REL_ID}/assets?name=${PACK_VERSION}.tar.gz" \ - -H "Authorization: token ${T}" -H "Content-Type: application/gzip" --data-binary @"${PACK_FILE}" || echo 000)" - echo "Asset upload HTTP: ${UP}" - cat /tmp/pack-asset.json | head -c 300; echo - echo "Release ${PACK_VERSION} created with pack asset"