fix: combine release workflow into single run block
Each Gitea Actions step is a separate shell session; git context did not persist between steps. All steps are now in one run block.
This commit is contained in:
1 parent
9b8a0e5075
commit
73a36d503a
1 file changed
+25
-23
@@ -7,60 +7,62 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
runs-on: shell
|
runs-on: shell
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout, build & release
|
||||||
|
env:
|
||||||
|
VERSION: ${{ gitea.ref_name }}
|
||||||
|
GITEA_API: ${{ gitea.api_url }}
|
||||||
|
GITEA_REPO: ${{ gitea.repository }}
|
||||||
run: |
|
run: |
|
||||||
git fetch origin --prune --tags
|
set -e
|
||||||
git checkout -f "${{ gitea.ref_name }}"
|
|
||||||
|
|
||||||
- name: Generate Release Notes
|
# ── Checkout ────────────────────────────────────────────────
|
||||||
id: notes
|
SRC="/tmp/epicnext-release"
|
||||||
run: |
|
rm -rf "$SRC"
|
||||||
|
git clone --branch "${VERSION}" --depth 1 \
|
||||||
|
/docker/gitea/gitea/git/repositories/remco/epicnext-cms.git \
|
||||||
|
"$SRC"
|
||||||
|
cd "$SRC"
|
||||||
|
|
||||||
|
# ── Generate Release Notes ───────────────────────────────────
|
||||||
PREV_TAG="$(git tag --sort=-creatordate | head -2 | tail -1 || echo '')"
|
PREV_TAG="$(git tag --sort=-creatordate | head -2 | tail -1 || echo '')"
|
||||||
if [ -n "$PREV_TAG" ]; then
|
if [ -n "$PREV_TAG" ]; then
|
||||||
RANGE="${PREV_TAG}..${{ gitea.ref_name }}"
|
RANGE="${PREV_TAG}..${VERSION}"
|
||||||
NOTES="$(git log --oneline --no-decorate "${RANGE}" 2>/dev/null || git log --oneline --no-decorate -20)"
|
NOTES="$(git log --oneline --no-decorate "${RANGE}" 2>/dev/null || git log --oneline --no-decorate -20)"
|
||||||
else
|
else
|
||||||
NOTES="$(git log --oneline --no-decorate -30)"
|
NOTES="$(git log --oneline --no-decorate -30)"
|
||||||
fi
|
fi
|
||||||
echo "NOTES<<EOF" >> "$GITHUB_ENV"
|
|
||||||
echo "$NOTES" >> "$GITHUB_ENV"
|
|
||||||
echo "EOF" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
echo "VERSION=${{ gitea.ref_name }}" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
echo "=== Release Notes ==="
|
echo "=== Release Notes ==="
|
||||||
echo "$NOTES"
|
echo "$NOTES"
|
||||||
|
|
||||||
- name: Build
|
# ── Build ────────────────────────────────────────────────────
|
||||||
run: |
|
|
||||||
cd /var/www/atom-nexst/
|
|
||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
pnpm prisma:generate
|
pnpm prisma:generate
|
||||||
export SKIP_ENV_VALIDATION=1
|
export SKIP_ENV_VALIDATION=1
|
||||||
pnpm build
|
pnpm build
|
||||||
|
|
||||||
- name: Create Release
|
# ── Create Gitea Release ─────────────────────────────────────
|
||||||
run: |
|
BODY="## EpicNext-CMS ${VERSION}
|
||||||
# Use the Gitea API to create a release
|
|
||||||
BODY="## EpicNext-CMS ${{ env.VERSION }}
|
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
${{ env.NOTES }}
|
${NOTES}
|
||||||
|
|
||||||
---
|
---
|
||||||
_Automated release from Gitea Actions_
|
_Automated release from Gitea Actions_
|
||||||
"
|
"
|
||||||
|
|
||||||
curl -s -X POST "${{ gitea.api_url }}/repos/${{ gitea.repository }}/releases" \
|
curl -s -X POST "${GITEA_API}/repos/${GITEA_REPO}/releases" \
|
||||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$(cat <<-ENDJSON
|
-d "$(cat <<-ENDJSON
|
||||||
{
|
{
|
||||||
"tag_name": "${{ env.VERSION }}",
|
"tag_name": "${VERSION}",
|
||||||
"name": "${{ env.VERSION }}",
|
"name": "${VERSION}",
|
||||||
"body": $(echo "$BODY" | jq -Rs '.'),
|
"body": $(echo "$BODY" | jq -Rs '.'),
|
||||||
"draft": false,
|
"draft": false,
|
||||||
"prerelease": false
|
"prerelease": false
|
||||||
}
|
}
|
||||||
ENDJSON
|
ENDJSON
|
||||||
)"
|
)"
|
||||||
|
|
||||||
|
echo "Release ${VERSION} created successfully!"
|
||||||
Reference in new issue
Block a user