fix: use local checkout for changelog generation
Local Build and Deploy / deploy (push) Successful in 1m26s
Local Build and Deploy / deploy (push) Successful in 1m26s
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.
This commit is contained in:
1 parent
15ed8ffbf0
commit
80bf3bb0d5
1 file changed
+20
-8
@@ -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*
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user