|
29 | 29 | run: mvn clean install -DskipTests -q |
30 | 30 | - name: Set up Maven Central |
31 | 31 | uses: actions/setup-java@v4 |
32 | | - with: # running setup-java again overwrites the settings.xml |
| 32 | + with: |
33 | 33 | java-version: 21 |
34 | 34 | distribution: 'temurin' |
35 | 35 | server-id: central |
|
44 | 44 | CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} |
45 | 45 | CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }} |
46 | 46 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |
| 47 | + |
| 48 | + update-release-notes: |
| 49 | + name: Update GitHub Release Notes |
| 50 | + needs: release |
| 51 | + runs-on: ubuntu-latest |
| 52 | + permissions: |
| 53 | + contents: write |
| 54 | + |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + with: |
| 58 | + fetch-depth: 0 |
| 59 | + |
| 60 | + - name: Generate and Update Release Notes |
| 61 | + continue-on-error: true |
| 62 | + env: |
| 63 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + run: | |
| 65 | + CURRENT_TAG=${{ github.ref_name }} |
| 66 | + VERSION_NUM=${CURRENT_TAG#v} |
| 67 | +
|
| 68 | + # Calculate previous tag using version sorting |
| 69 | + git fetch --tags --force |
| 70 | + PREV_TAG=$(git tag --sort=-v:refname | grep -A 1 "^${CURRENT_TAG}$" | tail -n 1) |
| 71 | +
|
| 72 | + # Fetch milestone ID for the link |
| 73 | + MILESTONE_ID=$(gh api repos/${{ github.repository }}/milestones -q ".[] | select(.title==\"$VERSION_NUM\") | .number") |
| 74 | +
|
| 75 | + # Fetch closed issues and PRs for this milestone, excluding the dependencies label |
| 76 | + gh issue list \ |
| 77 | + --repo ${{ github.repository }} \ |
| 78 | + --search "milestone:\"$VERSION_NUM\" is:closed -label:dependencies" \ |
| 79 | + --limit 100 \ |
| 80 | + --json title,url \ |
| 81 | + --jq '.[] | "- [\(.title)](\(.url))"' > milestone_issues.md |
| 82 | +
|
| 83 | + # Assemble the final changelog.md |
| 84 | + cat << EOF > changelog.md |
| 85 | + $(cat milestone_issues.md) |
| 86 | +
|
| 87 | + ## Changes |
| 88 | + - [$CURRENT_TAG](https://github.com/jooby-project/jooby/tree/$CURRENT_TAG) |
| 89 | + - [Issues](https://github.com/jooby-project/jooby/milestone/$MILESTONE_ID?closed=1) |
| 90 | + - [Changelog](https://github.com/jooby-project/jooby/compare/$PREV_TAG...$CURRENT_TAG) |
| 91 | + - [Dependencies](https://github.com/jooby-project/jooby/pulls?q=is%3Apr+label%3Adependencies+is%3Aclosed+milestone%3A$VERSION_NUM) |
| 92 | +
|
| 93 | + ## Support my work |
| 94 | + - [Sponsor](https://github.com/sponsors/jknack) |
| 95 | +
|
| 96 | + ### Sponsors |
| 97 | + - [@premium-minds](https://github.com/premium-minds) |
| 98 | + - [@agentgt](https://github.com/agentgt) |
| 99 | + - [@tipsy](https://github.com/tipsy) |
| 100 | + EOF |
| 101 | +
|
| 102 | + # Overwrite the existing release notes |
| 103 | + gh release edit $CURRENT_TAG --notes-file changelog.md |
0 commit comments