From 89c022b642bfa285ef2dd4d99a43f78e58bd2031 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 3 Jan 2022 18:25:31 +0000 Subject: [PATCH 1/4] Manually merged #737 --- .github/workflows/build.yml | 46 ++++++++++++++++++++++++ .github/workflows/early-access.yml | 55 ++++++++++++++++++++++++++++ build.gradle | 1 + gradle/github-releases.gradle | 35 ------------------ gradle/release.gradle | 58 ++++++++++++++++++++++++++++++ gradle/sdkman.gradle | 32 ----------------- gradle/signing.gradle | 20 ----------- jbake-core/build.gradle | 1 - jbake-dist/build.gradle | 17 +-------- jbake-maven-plugin/build.gradle | 1 - 10 files changed, 161 insertions(+), 105 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/early-access.yml delete mode 100644 gradle/github-releases.gradle create mode 100644 gradle/release.gradle delete mode 100644 gradle/sdkman.gradle delete mode 100644 gradle/signing.gradle diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..cce9a1cee --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build + +on: + pull_request: + +jobs: + build: + name: Build + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'zulu' + + - uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }} + restore-keys: | + ${{ runner.os }}-gradlew- + - name: Build + run: ./gradlew build -S + + - name: Upload Reports + uses: actions/upload-artifact@v1 + if: failure() + with: + name: reports-${{ runner.os }} + path: | + jbake-core/build + jbake-dist/build diff --git a/.github/workflows/early-access.yml b/.github/workflows/early-access.yml new file mode 100644 index 000000000..9d9aba2b6 --- /dev/null +++ b/.github/workflows/early-access.yml @@ -0,0 +1,55 @@ +name: EarlyAccess + +on: + push: + branches: [ master ] + +jobs: + earlyaccess: + name: EarlyAccess + if: github.repository == 'jbake-org/jbake' + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'zulu' + + - uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }} + restore-keys: | + ${{ runner.os }}-gradlew- + - name: Build + run: ./gradlew build -S + + - name: Release + run: ./gradlew jreleaserRelease -S + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} + JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} + + - name: JReleaser output + if: always() + uses: actions/upload-artifact@v2 + with: + name: jreleaser-logs + path: | + jbake-dist/build/jreleaser/trace.log + jbake-dist/build/jreleaser/output.properties diff --git a/build.gradle b/build.gradle index 6a2f560a7..b78764e40 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ plugins { id "io.github.gradle-nexus.publish-plugin" version "1.0.0" id 'com.github.ben-manes.versions' version '0.38.0' id 'org.ajoberstar.grgit' version "$grgitVersion" + id 'org.jreleaser' version "0.10.0" apply false id "eclipse" id "idea" } diff --git a/gradle/github-releases.gradle b/gradle/github-releases.gradle deleted file mode 100644 index 69c94696d..000000000 --- a/gradle/github-releases.gradle +++ /dev/null @@ -1,35 +0,0 @@ -rootProject.ext { - githubToken = project.hasProperty("github.token") ? project.getProperty("github.token") : System.getenv("GITHUBTOKEN") - githubReleaseOwner = project.hasProperty("github.release.owner") ? getProperty("github.release.owner") : System.getenv("GITHUB_RELEASE_OWNER") - githubReleaseRepo = project.hasProperty("github.release.repo") ? getProperty("github.release.repo") : System.getenv("GITHUB_RELEASE_REPO") - githubReleaseDryRun = System.getenv("GITHUB_RELEASE_DRY_RUN") ?: false -} - -afterEvaluate { - def name = project(':jbake-dist').tasks.getByName("distZip").archiveName - def files = project(':jbake-dist').tasks.getByName("distZip").outputs.files.files - if (!project.hasProperty('skipSigning')) { - def signatureFile = project(':jbake-dist').tasks.getByName("signArchives").outputs.files.files.find { it.name.contains(name) } - files << signatureFile - } - - // add checksum files - project(':jbake-dist').tasks.getByName("distZip").outputs.files.files.each { - files << new File(it.toString() + ".sha256") - } - - githubRelease { - token "$rootProject.githubToken" // This is your personal access token with Repo permissions - // You get this from your user settings > developer settings > Personal Access Tokens - owner "$rootProject.githubReleaseOwner" - // default is the last part of your group. Eg group: "com.github.breadmoirai" => owner: "breadmoirai" - repo "$rootProject.githubReleaseRepo" // by default this is set to your project name - targetCommitish "master" // by default this is set to "master" - draft false // by default this is false - releaseAssets files - // this points to which files you want to upload as assets with your release - dryRun rootProject.githubReleaseDryRun as boolean - // by default false; you can use this to see what actions would be taken without making a release - } -} - diff --git a/gradle/release.gradle b/gradle/release.gradle new file mode 100644 index 000000000..e51348c42 --- /dev/null +++ b/gradle/release.gradle @@ -0,0 +1,58 @@ +apply plugin: 'org.jreleaser' + +// cannot reference project. properties inside jreleaser config block +// as that collides with the "project" DSL element of the config extension +ext.releaseIsDryrun = (project.rootProject.findProperty('dryrun') ?: false).toBoolean() +ext.projectWebsite = project.website + +jreleaser { + dryrun = releaseIsDryrun + gitRootSearch = true + + project { + website = projectWebsite + authors = ['Jonathan Bullock'] + license = 'MIT' + extraProperties.put('inceptionYear', '2012') + } + + release { + github { + overwrite = true + branch = 'master' + changelog { + formatted = 'always' + format = '- {{commitShortHash}} {{commitTitle}}' + contributors { + format = '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}' + } + hide { + contributors = ['GitHub'] + } + } + } + } + + signing { + active = 'always' + armored = true + } + + checksum { + individual = true + } + + distributions { + jbake { + sdkman { + active = 'release' + } + artifact { + path = 'build/distributions/{{distributionName}}-{{projectVersion}}-bin.zip' + } + artifact { + path = 'build/distributions/{{distributionName}}-{{projectVersion}}.tar' + } + } + } +} diff --git a/gradle/sdkman.gradle b/gradle/sdkman.gradle deleted file mode 100644 index 3e907362c..000000000 --- a/gradle/sdkman.gradle +++ /dev/null @@ -1,32 +0,0 @@ -ext.sdkman_consumer_key = project.hasProperty('sdkman_consumer_key')?sdkman_consumer_key:'' -ext.sdkman_consumer_token = project.hasProperty('sdkman_consumer_token')?sdkman_consumer_token:'' - -sdkman { - consumerKey = project.sdkman_consumer_key - consumerToken = project.sdkman_consumer_token - candidate = "jbake" - version = rootProject.version - hashtag = "#JBake" - url = "https://github.com/jbake-org/jbake/releases/download/v${project.version}/${distZip.archiveFileName.get()}" -} - -task distributionAvailable() { - group = "Verification" - description = "Check if distribution is available on bintray" - - doLast { - String errorMsg = "Distribution is not available at $sdkman.url" - - HttpURLConnection connection = sdkman.url.toURL().openConnection() - connection.setRequestMethod("HEAD") - connection.connect() - - if ( connection.responseCode != 200 ){ - throw new GradleException(errorMsg) - } - } -} - -tasks.findAll{ it.name ==~ /sdk.*(Release|Version)/ }.each { - it.dependsOn distributionAvailable -} diff --git a/gradle/signing.gradle b/gradle/signing.gradle deleted file mode 100644 index 72cc887bb..000000000 --- a/gradle/signing.gradle +++ /dev/null @@ -1,20 +0,0 @@ -if ( !project.hasProperty('skipSigning') ) { - apply plugin: 'signing' - - if (!signing.signatory) { - logger.warn "No Signatory configured for project $project.name. Skip signing! See https://docs.gradle.org/current/userguide/signing_plugin.html" - ext.skipSigning = true - } - else { - if ( project.name != "jbake-dist" ) { - signing { - sign publishing.publications.mavenJava - } - } - else { - signing { - sign configurations.archives - } - } - } -} diff --git a/jbake-core/build.gradle b/jbake-core/build.gradle index b935114ff..72f66c0d5 100644 --- a/jbake-core/build.gradle +++ b/jbake-core/build.gradle @@ -7,7 +7,6 @@ plugins { } apply from: "$rootDir/gradle/maven-publishing.gradle" -apply from: "$rootDir/gradle/signing.gradle" description = "The core library of JBake" diff --git a/jbake-dist/build.gradle b/jbake-dist/build.gradle index bd5567bdf..85461d45a 100644 --- a/jbake-dist/build.gradle +++ b/jbake-dist/build.gradle @@ -1,15 +1,11 @@ plugins { - id "io.sdkman.vendors" version "2.0.0" id "com.github.breadmoirai.github-release" version "2.2.12" id "org.jbake.convention.java-common" id 'application' } apply from: "$rootDir/gradle/application.gradle" -apply from: "$rootDir/gradle/sdkman.gradle" -apply from: "$rootDir/gradle/signing.gradle" -apply from: "$rootDir/gradle/github-releases.gradle" - +apply from: "$rootDir/gradle/release.gradle" description = "The binary distribution package that bundles JBake cli" sourceSets { @@ -58,17 +54,6 @@ smokeTest { } } -task buildChecksum(dependsOn: distZip, group: "distribution") { - description "creates a sha256 checksum file for the distribution" - doLast { - distZip.outputs.files.files.each { - ant.checksum(file: it, fileext: ".sha256", algorithm: "SHA-256", pattern: "{0} {1}") - } - } -} - check.dependsOn smokeTest -distZip.finalizedBy buildChecksum - jar.enabled=false diff --git a/jbake-maven-plugin/build.gradle b/jbake-maven-plugin/build.gradle index eb119626c..c1482dbd7 100644 --- a/jbake-maven-plugin/build.gradle +++ b/jbake-maven-plugin/build.gradle @@ -6,7 +6,6 @@ plugins { group = "org.jbake" apply from: "$rootDir/gradle/maven-publishing.gradle" -apply from: "$rootDir/gradle/signing.gradle" publishing { publications { From e4aa9a8fc30ceb2d1705110a32ca2675f51ff503 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Wed, 5 Jan 2022 21:23:41 +0000 Subject: [PATCH 2/4] Added generation of HelpMojo. --- jbake-maven-plugin/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jbake-maven-plugin/build.gradle b/jbake-maven-plugin/build.gradle index c1482dbd7..68a8da43a 100644 --- a/jbake-maven-plugin/build.gradle +++ b/jbake-maven-plugin/build.gradle @@ -5,6 +5,10 @@ plugins { group = "org.jbake" +mavenPlugin { + helpMojoPackage = 'org.jbake.maven' +} + apply from: "$rootDir/gradle/maven-publishing.gradle" publishing { From 039d6faa58d4a12c18d9e0a9e9531939ded12752 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Wed, 5 Jan 2022 22:27:15 +0000 Subject: [PATCH 3/4] Removed github-release plugin, replaced with JReleaser. --- jbake-dist/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/jbake-dist/build.gradle b/jbake-dist/build.gradle index 85461d45a..110718421 100644 --- a/jbake-dist/build.gradle +++ b/jbake-dist/build.gradle @@ -1,5 +1,4 @@ plugins { - id "com.github.breadmoirai.github-release" version "2.2.12" id "org.jbake.convention.java-common" id 'application' } From 9afb5521947079f8adb8deca816384c31cd0da76 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Wed, 5 Jan 2022 22:39:52 +0000 Subject: [PATCH 4/4] Moved all plugin versions into gradle.properties --- build.gradle | 2 +- gradle.properties | 4 ++-- jbake-maven-plugin/build.gradle | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 07741c18f..9a3787aa2 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { id "io.github.gradle-nexus.publish-plugin" version "$nexusPublishPluginVersion" id 'com.github.ben-manes.versions' version "$versionsPluginVersion" id 'org.ajoberstar.grgit' version "$grgitVersion" - id 'org.jreleaser' version "0.10.0" apply false + id 'org.jreleaser' version "$jreleaserVersion" apply false id "eclipse" id "idea" } diff --git a/gradle.properties b/gradle.properties index 3e1f0d23b..cb81cde7c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -45,9 +45,9 @@ jacocoVersion = 0.8.7 grgitVersion = 4.1.1 nexusPublishPluginVersion = 1.1.0 versionsPluginVersion = 0.40.0 -sdkmanVersion = 3.0.0 -githubReleaseVersion = 2.2.12 optionalBaseVersion = 7.0.0 +jreleaserVersion = 0.10.0 +mavenPluginDevVersion = 0.3.1 # jbake-maven-plugin dependencies mavenVersion = 3.8.4 diff --git a/jbake-maven-plugin/build.gradle b/jbake-maven-plugin/build.gradle index 68a8da43a..fabf47e20 100644 --- a/jbake-maven-plugin/build.gradle +++ b/jbake-maven-plugin/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'de.benediktritter.maven-plugin-development' version '0.3.1' + id 'de.benediktritter.maven-plugin-development' version "$mavenPluginDevVersion" id "org.jbake.convention.java-common" }