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 d0bb98f42..9a3787aa2 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +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 "$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/gradle/github-releases.gradle b/gradle/github-releases.gradle deleted file mode 100644 index 116c8ac07..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").archiveFileName.getOrNull() - 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 476112c38..a64a6f07c 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 bbf846f0d..110718421 100644 --- a/jbake-dist/build.gradle +++ b/jbake-dist/build.gradle @@ -1,15 +1,10 @@ plugins { - id "io.sdkman.vendors" version "$sdkmanVersion" - id "com.github.breadmoirai.github-release" version "$githubReleaseVersion" 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 +53,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..fabf47e20 100644 --- a/jbake-maven-plugin/build.gradle +++ b/jbake-maven-plugin/build.gradle @@ -1,12 +1,15 @@ 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" } group = "org.jbake" +mavenPlugin { + helpMojoPackage = 'org.jbake.maven' +} + apply from: "$rootDir/gradle/maven-publishing.gradle" -apply from: "$rootDir/gradle/signing.gradle" publishing { publications {