-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from LMAX-Exchange/automaticreleases
Automate Releases Using GitHub Actions
- Loading branch information
Showing
4 changed files
with
148 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,63 @@ jobs: | |
name: Java ${{ matrix.java }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build | ||
|
||
dependency-submission: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
|
||
- name: Generate and submit dependency graph | ||
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 | ||
|
||
javadoc: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pages: write | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Build Javadoc | ||
run: ./gradlew javadoc | ||
|
||
- name: Deploy Pages Content | ||
uses: JamesIves/[email protected] | ||
# https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable | ||
if: ${{ always() && format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }} | ||
with: | ||
folder: build/docs/javadoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Publish Release Artifacts | ||
on: | ||
release: | ||
types: [ created ] | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
id-token: write | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- name: Set Gradle App Version to ${{ github.event.release.tag_name }} | ||
run: sed -i "s/version = '.*'/version = '${{ github.event.release.tag_name }}'/g" build.gradle | ||
- name: Publish package | ||
uses: gradle/[email protected] | ||
with: | ||
arguments: publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Publish package to Maven Central | ||
uses: gradle/[email protected] | ||
with: | ||
arguments: jreleaserFullRelease | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }} | ||
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }} | ||
JRELEASER_GPG_SECRET_KEY: "${{ secrets.JRELEASER_GPG_SECRET_KEY }}" | ||
JRELEASER_GPG_PUBLIC_KEY: "${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}" | ||
JRELEASER_GPG_PASSPHRASE: "${{ secrets.JRELEASER_GPG_PASSPHRASE }}" | ||
JRELEASER_GITHUB_TOKEN: ${{ github.token }} | ||
JRELEASER_MAVENCENTRAL_STAGE: "FULL" | ||
- name: Add Artifact to GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: build/libs/disruptor-proxy-*.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,32 +15,29 @@ | |
*/ | ||
|
||
plugins { | ||
id 'java' | ||
id 'java-library' | ||
id 'maven-publish' | ||
id 'signing' | ||
id 'checkstyle' | ||
id 'idea' | ||
id "biz.aQute.bnd.builder" version "6.3.1" | ||
id 'org.jreleaser' version '1.14.0' | ||
} | ||
|
||
|
||
defaultTasks 'checkstyleTest', 'checkstyleMain', 'build' | ||
|
||
group = 'com.lmax' | ||
version = new Version(major: 2, minor: 2, revision: 0) | ||
// The below is updated by CI during the release | ||
version = '1.0.0' | ||
|
||
ext { | ||
fullName = 'Disruptor-Proxy' | ||
fullDescription = 'A utility for generating Disruptor-backed proxies for easy execution serialisation' | ||
teamName = 'LMAX Development Team' | ||
siteUrl = 'http://github.com/LMAX-Exchange/disruptor-proxy' | ||
siteUrl = 'https://github.com/LMAX-Exchange/disruptor-proxy' | ||
sourceUrl = '[email protected]:LMAX-Exchange/disruptor-proxy.git' | ||
|
||
javaCompilerExecutable = System.env['JAVA_HOME'] ? System.env['JAVA_HOME'] + '/bin/javac' : 'javac' | ||
|
||
if (!project.hasProperty('sonatypeUrl')) sonatypeUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2' | ||
if (!project.hasProperty('sonatypeUsername')) sonatypeUsername = '' | ||
if (!project.hasProperty('sonatypePassword')) sonatypePassword = '' | ||
} | ||
|
||
repositories { | ||
|
@@ -55,40 +52,26 @@ dependencies { | |
} | ||
|
||
|
||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
|
||
jar { | ||
manifest.attributes('Built-By': System.properties['user.name'], | ||
'Bundle-Name': fullName, | ||
'Bundle-Vendor': teamName, | ||
'Bundle-Description': fullDescription, | ||
'Bundle-DocURL': siteUrl) | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(11) | ||
} | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
checkstyle { | ||
toolVersion = 6.3 | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
artifacts { | ||
archives sourcesJar, javadocJar | ||
} | ||
|
||
publishing { | ||
publications { | ||
disruptor(MavenPublication) { | ||
from components.java | ||
|
||
groupId = 'com.lmax' | ||
artifactId = 'disruptor-proxy' | ||
|
||
pom { | ||
name = project.ext.fullName | ||
description = project.ext.fullDescription | ||
|
@@ -97,50 +80,59 @@ publishing { | |
scm { | ||
url = "scm:${project.ext.sourceUrl}" | ||
connection = "scm:${project.ext.sourceUrl}" | ||
developerConnection = "scm:${project.ext.sourceUrl}" | ||
} | ||
|
||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
name = 'Apache-2.0' | ||
url = 'https://spdx.org/licenses/Apache-2.0.html' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'team' | ||
id = 'LMAX Group Open Source' | ||
name = teamName | ||
email = 'disruptor-proxy@googlegroups.com' | ||
email = 'opensource@lmax.com' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
repositories { | ||
maven { | ||
url project.hasProperty('sonatypeUrl') ? project['sonatypeUrl'] : 'https://oss.sonatype.org/service/local/staging/deploy/maven2' | ||
|
||
credentials { | ||
username = project.hasProperty('sonatypeUsername') ? project['sonatypeUsername'] : 'fake-user' | ||
password = project.hasProperty('sonatypePassword') ? project['sonatypePassword'] : 'fake-password' | ||
} | ||
url = layout.buildDirectory.dir('staging-deploy') | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign publishing.publications.disruptor | ||
} | ||
|
||
|
||
|
||
class Version { | ||
int major, minor = 0, revision = 0 | ||
boolean snapshot | ||
String stage | ||
|
||
String toString() { | ||
"$major.$minor.$revision${stage ? '.' + stage : ''}${snapshot ? '-SNAPSHOT' : ''}" | ||
jreleaser { | ||
files { | ||
active = 'ALWAYS' | ||
glob { | ||
pattern = 'build/staging-deploy/**/*.jar' | ||
pattern = 'build/staging-deploy/**/*.pom' | ||
pattern = 'build/staging-deploy/**/*.module' | ||
} | ||
} | ||
signing { | ||
active = 'ALWAYS' | ||
armored = true | ||
mode = 'MEMORY' | ||
} | ||
deploy { | ||
maven { | ||
mavenCentral { | ||
sonatype { | ||
active = 'ALWAYS' | ||
url = 'https://central.sonatype.com/api/v1/publisher' | ||
stagingRepository('build/staging-deploy') | ||
applyMavenCentralRules = true | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |