From 80bf3bb0d54b27f068d6bf6e476bf999261eb074 Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 20 Jul 2026 15:16:19 +0200 Subject: [PATCH] fix: use local checkout for changelog generation Bare git repo has no HEAD; git log without --all showed nothing. Now uses /var/www/atom-nexst (full checkout with proper HEAD). Also adds debug output and handles first-release edge case. --- .gitea/workflows/release.yaml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index dcfee137..44923581 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -15,25 +15,33 @@ jobs: run: | set -e - REPO="/docker/gitea/gitea/git/repositories/remco/epicnext-cms.git" + # Use the local checkout (has full history + HEAD) + LOCAL="/var/www/atom-nexst" # ── Generate changelog ──────────────────────────────────────── - PREV_TAG="$(git -C "$REPO" tag --sort=-creatordate | head -2 | tail -1 || echo '')" - if [ -n "$PREV_TAG" ]; then + PREV_TAG="$(git -C "$LOCAL" tag --sort=-creatordate | head -2 | tail -1 || echo '')" + echo "=== Debug: VERSION=$VERSION PREV_TAG=$PREV_TAG ===" + + if [ -n "$PREV_TAG" ] && [ "$PREV_TAG" != "$VERSION" ]; then RANGE="${PREV_TAG}..${VERSION}" - git -C "$REPO" log --oneline --no-decorate "${RANGE}" > /tmp/changelog.txt 2>/dev/null || \ - git -C "$REPO" log --oneline --no-decorate -30 > /tmp/changelog.txt + echo "=== Range: $RANGE ===" + git -C "$LOCAL" log --oneline --no-decorate "${RANGE}" > /tmp/changelog.txt else - git -C "$REPO" log --oneline --no-decorate -30 > /tmp/changelog.txt + # First release or only one tag — show all commits up to this tag + echo "=== First release or only one tag, showing all commits ===" + git -C "$LOCAL" log --oneline --no-decorate "${VERSION}" > /tmp/changelog.txt fi echo "=== Changelog ===" cat /tmp/changelog.txt + echo "=== End changelog ===" # ── Build ───────────────────────────────────────────────────── SRC="/tmp/epicnext-release" rm -rf "$SRC" - git clone --branch "${VERSION}" --depth 1 "$REPO" "$SRC" + git clone --branch "${VERSION}" --depth 1 \ + /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git \ + "$SRC" cd "$SRC" if [ -f /var/www/atom-nexst/.env ]; then @@ -54,12 +62,16 @@ repo = os.environ['GITEA_REPO'] token = "${{ secrets.GITEA_TOKEN }}" with open('/tmp/changelog.txt') as f: - notes = f.read() + notes = f.read().strip() + +if not notes: + notes = "Initial release" body = f"""## EpicNext-CMS {version} ### Changes {notes} + --- *Automated release from Gitea Actions* """