From 6060a7d85a90131105836ae96b2e14dcab19b716 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Jun 2025 16:58:55 +0100 Subject: [PATCH] Update .forgejo/workflows/release.yml --- .forgejo/workflows/release.yml | 99 +++++++++++++++++----------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index b0b1bc1..8865b4f 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -53,6 +53,56 @@ jobs: git commit -am "Release ${{ steps.version.outputs.release_version }}" git push + # Create the release notes (closed issues) + # Must be here, before the new tag, to get closed issued from the LAST TAG to NOW + - name: Generate release notes from closed issues + id: generate_notes + run: | + REPO_OWNER="root" + REPO_NAME="resilient" + TOKEN="${{ secrets.FORGEJO_TOKEN }}" + VERSION="${{ steps.version.outputs.release_version }}" + API_BASE="https://git.oguerreiro.com/api/v1" + + echo "Fetching latest release tag..." + LATEST_TAG=$(curl -sf -H "Authorization: token $TOKEN" \ + "$API_BASE/repos/$REPO_OWNER/$REPO_NAME/tags" \ + | jq -r '.[0].name') + + if [[ -z "$LATEST_TAG" || "$LATEST_TAG" == "null" ]]; then + echo "No previous tags found. Assuming first release." + CLOSED_ISSUES="" + else + echo "Latest tag is: $LATEST_TAG" + + # Get ISO timestamp of the latest tag commit + COMMIT_DATE=$(git log -1 --format=%cI "$LATEST_TAG") + echo "Fetching closed issues since $COMMIT_DATE..." + + CLOSED_ISSUES_JSON=$(curl -sf -H "Authorization: token $TOKEN" \ + "$API_BASE/repos/$REPO_OWNER/$REPO_NAME/issues?state=closed&since=$COMMIT_DATE") + + if [[ -z "$CLOSED_ISSUES_JSON" ]]; then + echo "Warning: No closed issues or invalid response." + CLOSED_ISSUES="" + else + CLOSED_ISSUES=$(echo "$CLOSED_ISSUES_JSON" | jq -r '.[] | "- [#\(.number)](\(.html_url)) \(.title)"') + fi + fi + + # Build release notes markdown + { + echo "## Release v$VERSION" + echo + if [[ -n "$CLOSED_ISSUES" ]]; then + echo "### Closed Issues" + echo "$CLOSED_ISSUES" + else + echo "No issues closed since last release." + fi + } > release-notes.md + cat release-notes.md + - name: Tag release run: | git tag -a v${{ steps.version.outputs.release_version }} -m "Release ${{ steps.version.outputs.release_version }}" @@ -106,55 +156,6 @@ jobs: name: app-backend path: target/resilient*.jar - # Create the release notes (closed issues) - - name: Generate release notes from closed issues - id: generate_notes - run: | - REPO_OWNER="root" - REPO_NAME="resilient" - TOKEN="${{ secrets.FORGEJO_TOKEN }}" - VERSION="${{ steps.version.outputs.release_version }}" - API_BASE="https://git.oguerreiro.com/api/v1" - - echo "Fetching latest release tag..." - LATEST_TAG=$(curl -sf -H "Authorization: token $TOKEN" \ - "$API_BASE/repos/$REPO_OWNER/$REPO_NAME/tags" \ - | jq -r '.[0].name') - - if [[ -z "$LATEST_TAG" || "$LATEST_TAG" == "null" ]]; then - echo "No previous tags found. Assuming first release." - CLOSED_ISSUES="" - else - echo "Latest tag is: $LATEST_TAG" - - # Get ISO timestamp of the latest tag commit - COMMIT_DATE=$(git log -1 --format=%cI "$LATEST_TAG") - echo "Fetching closed issues since $COMMIT_DATE..." - - CLOSED_ISSUES_JSON=$(curl -sf -H "Authorization: token $TOKEN" \ - "$API_BASE/repos/$REPO_OWNER/$REPO_NAME/issues?state=closed&since=$COMMIT_DATE") - - if [[ -z "$CLOSED_ISSUES_JSON" ]]; then - echo "Warning: No closed issues or invalid response." - CLOSED_ISSUES="" - else - CLOSED_ISSUES=$(echo "$CLOSED_ISSUES_JSON" | jq -r '.[] | "- [#\(.number)](\(.html_url)) \(.title)"') - fi - fi - - # Build release notes markdown - { - echo "## Release v$VERSION" - echo - if [[ -n "$CLOSED_ISSUES" ]]; then - echo "### Closed Issues" - echo "$CLOSED_ISSUES" - else - echo "No issues closed since last release." - fi - } > release-notes.md - cat release-notes.md - # Create the release # NOTE: added system dependency install "jq" - name: Create release and upload JAR