Repository navigation
handlebars.java 4.5.7 #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Maven Central | |
| on: | |
| release: | |
| types: [created] | |
| jobs: | |
| release: | |
| name: Maven Central | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build | |
| run: mvn clean install -DskipTests -q | |
| - name: Set up Maven Central | |
| uses: actions/setup-java@v4 | |
| with: # running setup-java again overwrites the settings.xml | |
| java-version: 17 | |
| distribution: 'temurin' | |
| server-id: ossrh | |
| server-username: CENTRAL_USERNAME | |
| server-password: CENTRAL_TOKEN | |
| gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Publish to Maven Central | |
| run: mvn -pl '!tests,!handlebars-maven-plugin-tests' clean deploy -P central -DskipTests | |
| env: | |
| CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} | |
| CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| update-release-notes: | |
| name: Update GitHub Release Notes | |
| needs: release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write # Required to update/close milestones | |
| pull-requests: read # Required for 'gh pr list' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate and Update Release Notes | |
| continue-on-error: true | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| CURRENT_TAG=${{ github.ref_name }} | |
| VERSION_NUM=${CURRENT_TAG#v} | |
| # Calculate previous tag using version sorting | |
| git fetch --tags --force | |
| PREV_TAG=$(git tag --sort=-v:refname | grep -A 1 "^${CURRENT_TAG}$" | tail -n 1) | |
| # Fetch milestone ID for the link | |
| MILESTONE_ID=$(gh api repos/${{ github.repository }}/milestones -q ".[] | select(.title==\"$VERSION_NUM\") | .number") | |
| # 1. Fetch BREAKING changes | |
| gh issue list \ | |
| --repo ${{ github.repository }} \ | |
| --search "milestone:\"$VERSION_NUM\" label:break-change" \ | |
| --state all \ | |
| --limit 100 \ | |
| --json title,number \ | |
| --jq '.[] | "- \(.title) #\(.number)"' > breaking_issues.md | |
| # 2. Fetch NEW features | |
| gh issue list \ | |
| --repo ${{ github.repository }} \ | |
| --search "milestone:\"$VERSION_NUM\" label:feature -label:break-change" \ | |
| --state all \ | |
| --limit 100 \ | |
| --json title,number \ | |
| --jq '.[] | "- \(.title) #\(.number)"' > new_issues.md | |
| # 3. Fetch DEPRECATED changes | |
| gh issue list \ | |
| --repo ${{ github.repository }} \ | |
| --search "milestone:\"$VERSION_NUM\" label:deprecated -label:break-change" \ | |
| --state all \ | |
| --limit 100 \ | |
| --json title,number \ | |
| --jq '.[] | "- \(.title) #\(.number)"' > deprecated_issues.md | |
| # 4. Fetch OTHER changes | |
| gh issue list \ | |
| --repo ${{ github.repository }} \ | |
| --search "milestone:\"$VERSION_NUM\" -label:feature -label:break-change -label:deprecated -label:dependencies" \ | |
| --state all \ | |
| --limit 100 \ | |
| --json title,number \ | |
| --jq '.[] | "- \(.title) #\(.number)"' > other_issues.md | |
| # 5. Fetch UNLINKED Pull Requests (Merged PRs not fixing an issue) | |
| gh pr list \ | |
| --repo ${{ github.repository }} \ | |
| --search "milestone:\"$VERSION_NUM\" is:merged -linked:issue -author:app/dependabot -label:dependencies" \ | |
| --limit 100 \ | |
| --json title,number \ | |
| --jq '.[] | "- \(.title) #\(.number)"' > unlinked_prs.md | |
| # 6. Merge generic changes and standalone PRs into one file | |
| cat other_issues.md unlinked_prs.md > merged_changes.md | |
| # 7. Initialize the changelog file | |
| > changelog.md | |
| # 8. Conditionally add "Breaking Changes" | |
| if [ -s breaking_issues.md ]; then | |
| echo "## ⚠️ Breaking Changes" >> changelog.md | |
| echo "" >> changelog.md | |
| cat breaking_issues.md >> changelog.md | |
| echo "" >> changelog.md | |
| fi | |
| # 9. Conditionally add "What's New" | |
| if [ -s new_issues.md ]; then | |
| echo "## 🚀 What's New" >> changelog.md | |
| echo "" >> changelog.md | |
| cat new_issues.md >> changelog.md | |
| echo "" >> changelog.md | |
| fi | |
| # 10. Conditionally add "Changes & Pull Requests" | |
| if [ -s merged_changes.md ]; then | |
| echo "## 🛠️ Changes" >> changelog.md | |
| echo "" >> changelog.md | |
| cat merged_changes.md >> changelog.md | |
| echo "" >> changelog.md | |
| fi | |
| # 11. Conditionally add "Deprecated" | |
| if [ -s deprecated_issues.md ]; then | |
| echo "## 🗑️ Deprecated" >> changelog.md | |
| echo "" >> changelog.md | |
| cat deprecated_issues.md >> changelog.md | |
| echo "" >> changelog.md | |
| fi | |
| # 12. Build the rest of the changelog (Links & Resources only) | |
| cat << EOF >> changelog.md | |
| ## 🔗 Links & Resources | |
| - [$CURRENT_TAG](https://github.com/${{ github.repository }}/tree/$CURRENT_TAG) | |
| - [Closed Issues](https://github.com/${{ github.repository }}/milestone/$MILESTONE_ID?closed=1) | |
| - [Changelog](https://github.com/${{ github.repository }}/compare/$PREV_TAG...$CURRENT_TAG) | |
| - [Dependency Updates](https://github.com/${{ github.repository }}/pulls?q=is%3Apr+label%3Adependencies+is%3Aclosed+milestone%3A$VERSION_NUM) | |
| EOF | |
| # Overwrite the existing release notes | |
| gh release edit $CURRENT_TAG --notes-file changelog.md | |
| - name: Close Milestone | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| CURRENT_TAG=${{ github.ref_name }} | |
| VERSION_NUM=${CURRENT_TAG#v} | |
| # Fetch the ID of the milestone only if it is currently open | |
| MILESTONE_ID=$(gh api repos/${{ github.repository }}/milestones -q ".[] | select(.title==\"$VERSION_NUM\" and .state==\"open\") | .number") | |
| if [ -n "$MILESTONE_ID" ]; then | |
| echo "Closing milestone $VERSION_NUM (ID: $MILESTONE_ID)..." | |
| gh api \ | |
| --method PATCH \ | |
| -H "Accept: application/vnd.github+json" \ | |
| repos/${{ github.repository }}/milestones/$MILESTONE_ID \ | |
| -f state='closed' | |
| echo "Milestone closed successfully." | |
| else | |
| echo "No open milestone found matching version $VERSION_NUM. Skipping." | |
| fi |