Skip to content

Commit

Permalink
Create GitHub releases using spotless-changelog (#2196)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg authored Aug 25, 2024
2 parents 3063abb + 8d28afb commit 45d73ec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
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 }}
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}}"
runAfterPush "gh release create ${kind}/{{version}} --title '${releaseTitle} v{{version}}' --notes-from-tag"

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

0 comments on commit 45d73ec

Please sign in to comment.