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

Configure JReleaser #737

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is. Don't count on that feature to be permanent, as you may have noticed in this issue actions/setup-java#40 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

I am reporter of actions/setup-java#40 and this is only about configuring Maven but not about caching at all (particularly not about caching Gradle artifacts)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm well aware of that which is why I typed "as you may have noticed". IMHO setup-java should be concerned with just that: setting up a suitable JDK/JRE/JR. Adding caching for Maven or any other Java build tool is beyond its scope.

Copy link
Contributor

@kwin kwin Jan 2, 2022

Choose a reason for hiding this comment

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

This may happen, but never in a 2.x release of setup-java (is it would be backwards-incompatible). As long as you use setup-java@v2 I would recommend getting rid of additional caching action steps and leverage what is shipped with setup-java@v2 as having additional steps

  1. makes your yml larger
  2. doesn't provide additional functionality
  3. defers builds as every step is additional overhead

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
57 changes: 57 additions & 0 deletions .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
plugins {
id "eclipse"
id "idea"
id "io.sdkman.vendors" version "2.0.0" apply false
id "com.github.kt3k.coveralls" version "2.10.2" apply false
id "org.sonarqube" version "3.1.1" apply false
id 'com.github.ben-manes.versions' version '0.38.0'
id "nebula.optional-base" version "5.0.3" apply false
id 'org.ajoberstar.grgit' version "$grgitVersion"
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
id "com.github.breadmoirai.github-release" version "2.2.12"
id 'org.jreleaser' version "0.10.0" apply false
}

// common variables
Expand Down
35 changes: 0 additions & 35 deletions gradle/github-releases.gradle

This file was deleted.

58 changes: 58 additions & 0 deletions gradle/release.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
}
}
}
34 changes: 0 additions & 34 deletions gradle/sdkman.gradle

This file was deleted.

20 changes: 0 additions & 20 deletions gradle/signing.gradle

This file was deleted.

15 changes: 1 addition & 14 deletions jbake-dist/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
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"

Expand Down Expand Up @@ -51,17 +49,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