Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create GitHub releases using spotless-changelog #2196

Merged
merged 9 commits into from
Aug 25, 2024
8 changes: 6 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# GH_TOKEN
# NEXUS_USER
# NEXUS_PASS64 (base64 NOTE: `base64` and `openssl base64` failed, had to use Java
# byte[] data = "{{password}}".getBytes(StandardCharsets.UTF_8);
Expand Down Expand Up @@ -29,8 +28,10 @@ jobs:
build:
runs-on: ubuntu-latest
name: deploy
permissions:
contents: write
env:
gh_token: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
nedtwigg marked this conversation as resolved.
Show resolved Hide resolved
ORG_GRADLE_PROJECT_nexus_user: ${{ secrets.NEXUS_USER }}
ORG_GRADLE_PROJECT_nexus_pass64: ${{ secrets.NEXUS_PASS64 }}
ORG_GRADLE_PROJECT_gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
Expand Down Expand Up @@ -64,3 +65,6 @@ jobs:
if: "${{ github.event.inputs.to_publish == 'lib' }}"
run: |
./gradlew :changelogPush -Prelease=true --stacktrace --warning-mode all --no-configuration-cache
- run: git checkout main
- run: git merge release --ff-only
- run: git push origin main
12 changes: 9 additions & 3 deletions gradle/changelog.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
String kind
String releaseTitle
if (project.name == 'plugin-gradle') {
kind = 'gradle'
releaseTitle = 'Gradle Plugin'
} else if (project.name == 'plugin-maven') {
kind = 'maven'
releaseTitle = 'Maven Plugin'
} else {
assert project == rootProject
kind = 'lib'
releaseTitle = 'Lib'
}

// the root project and plugins have their own changelogs
Expand All @@ -18,13 +22,15 @@ spotlessChangelog {
branch 'release'
tagPrefix "${kind}/"
commitMessage "Published ${kind}/{{version}}" // {{version}} will be replaced
tagMessage "${kind} v{{version}}\n\n{{changes}}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ${kind} v{{version}}\n looks redundant.

image image

runAfterPush "gh release create ${kind}/{{version}} --title '${releaseTitle} v{{version}}' --notes-from-tag"
Comment on lines +25 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! TIL.


if (kind == 'gradle') {
forceNextVersion '7.0.0.BETA1'
forceNextVersion '7.0.0.BETA2'
} else if (kind == 'maven') {
forceNextVersion '2.44.0.BETA1'
forceNextVersion '2.44.0.BETA2'
} else {
forceNextVersion '3.0.0.BETA1'
forceNextVersion '3.0.0.BETA2'
}
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
// https://github.com/spotbugs/spotbugs-gradle-plugin/releases
id 'com.github.spotbugs' version '6.0.20' apply false
// https://github.com/diffplug/spotless-changelog/blob/main/CHANGELOG.md
id 'com.diffplug.spotless-changelog' version '3.0.2' apply false
id 'com.diffplug.spotless-changelog' version '3.1.2' apply false
// https://github.com/radarsh/gradle-test-logger-plugin/blob/develop/CHANGELOG.md
id 'com.adarshr.test-logger' version '4.0.0' apply false
// https://github.com/davidburstrom/version-compatibility-gradle-plugin/tags
Expand Down
Loading