-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: move build and publish to mavencentral
- Loading branch information
Showing
7 changed files
with
197 additions
and
151 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# This workflow will build a Java project with Gradle | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
|
||
name: Run build and tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
environment: CIRelease | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --all --tags | ||
|
||
- name: Create .gradle dir | ||
run: mkdir -p $HOME/.gradle | ||
- name: Install gpg secret key | ||
env: | ||
SIGNINGFILE: ${{ secrets.SIGNINGFILE }} | ||
run: | | ||
cat <(echo -e "${{ secrets.SIGNINGFILE }}") | gpg --batch --import | ||
gpg --list-secret-keys --keyid-format LONG | ||
- name: Export gpg file | ||
env: | ||
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }} | ||
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }} | ||
run: | | ||
gpg --batch --passphrase="$SIGNINGPASSWORD" --pinentry-mode loopback --export-secret-keys $SIGNINGKEYID > $HOME/.gradle/secrets.gpg | ||
- name: Create gradle sproperties | ||
env: | ||
APIKEY: ${{ secrets.APIKEY }} | ||
APISECRET: ${{ secrets.APISECRET }} | ||
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }} | ||
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }} | ||
SONATYPEPASSWORD: ${{ secrets.SONATYPEPASSWORD }} | ||
SONATYPEUSER: ${{ secrets.SONATYPEUSER }} | ||
run: echo -e "gradle.publish.key=$APIKEY\ngradle.publish.secret=$APISECRET\nsigning.keyId=$SIGNINGKEYID\nsigning.password=$SIGNINGPASSWORD\nsigning.secretKeyRingFile=$HOME/.gradle/secrets.gpg\nsonatypeUsername=$SONATYPEUSER\nsonatypePassword=$SONATYPEPASSWORD" > $HOME/.gradle/gradle.properties | ||
- name: Build and test with Gradle | ||
env: | ||
JAVA_OPTS: "-Xmx1024M -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512M" | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=true" | ||
run: ./gradlew test build -s | ||
- name: Post Build | ||
run: rm -f $HOME/.gradle/gradle.properties && rm -f $HOME/.docker/config.json |
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,56 @@ | ||
# This workflow will build a Java project with Gradle | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
|
||
name: Run release build from tag | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
release: | ||
environment: CIRelease | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --all --tag | ||
- name: Create .gradle dir | ||
run: mkdir -p $HOME/.gradle | ||
- id: install-secret-key | ||
name: Install gpg secret key | ||
env: | ||
SIGNINGFILE: ${{ secrets.SIGNINGFILE }} | ||
run: | | ||
cat <(echo -e "${{ secrets.SIGNINGFILE }}") | gpg --batch --import | ||
gpg --list-secret-keys --keyid-format LONG | ||
- id: export-gpg-file | ||
name: Export gpg file | ||
env: | ||
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }} | ||
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }} | ||
run: | | ||
gpg --batch --passphrase="$SIGNINGPASSWORD" --pinentry-mode loopback --export-secret-keys $SIGNINGKEYID > $HOME/.gradle/secrets.gpg | ||
- name: Create gradle sproperties | ||
env: | ||
APIKEY: ${{ secrets.APIKEY }} | ||
APISECRET: ${{ secrets.APISECRET }} | ||
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }} | ||
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }} | ||
SONATYPEPASSWORD: ${{ secrets.SONATYPEPASSWORD }} | ||
SONATYPEUSER: ${{ secrets.SONATYPEUSER }} | ||
run: echo -e "gradle.publish.key=$APIKEY\ngradle.publish.secret=$APISECRET\nsigning.keyId=$SIGNINGKEYID\nsigning.password=$SIGNINGPASSWORD\nsigning.secretKeyRingFile=$HOME/.gradle/secrets.gpg\nsonatypeUsername=$SONATYPEUSER\nsonatypePassword=$SONATYPEPASSWORD" > $HOME/.gradle/gradle.properties | ||
- name: Run gradle release | ||
env: | ||
JAVA_OPTS: "-Xmx1024M -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512M" | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=true" | ||
run: ./gradlew -PrunOnCI=true test build :publishIntershopMvnPublicationToMavenRepository :publishPlugins -s | ||
- name: Post Build | ||
run: rm -f $HOME/.gradle/gradle.properties |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -25,22 +25,19 @@ plugins { | |
id 'idea' | ||
|
||
// intershop test plugin | ||
id 'com.intershop.gradle.test' version '2.1.0' | ||
|
||
// plugin for documentation | ||
id 'org.asciidoctor.convert' version '1.5.3' | ||
id 'com.intershop.gradle.test' version '2.2.0' | ||
|
||
// publish plugin | ||
id 'maven-publish' | ||
|
||
// artifact signing - necessary on Maven Central | ||
id 'signing' | ||
|
||
// intershop version plugin | ||
id 'com.intershop.gradle.scmversion' version '2.1.0' | ||
id 'com.intershop.gradle.scmversion' version '2.7.4' | ||
|
||
// plugin for publishing to Gradle Portal | ||
id 'com.gradle.plugin-publish' version '0.9.5' | ||
|
||
// plugin for publishing to jcenter | ||
id 'com.jfrog.bintray' version '1.7.1' | ||
id 'com.gradle.plugin-publish' version '0.20.0' | ||
} | ||
|
||
scm { | ||
|
@@ -66,49 +63,6 @@ test { | |
systemProperty 'intershop.gradle.versions', '2.11, 3.1' | ||
} | ||
|
||
task copyAsciiDoc { | ||
def outputDir = file("$buildDir/tmp/asciidoctorSrc") | ||
def inputFiles = fileTree(dir: rootDir, include: '**/*.asciidoc') | ||
|
||
inputs.files inputFiles | ||
outputs.dir outputDir | ||
|
||
doLast { | ||
outputDir.mkdirs() | ||
|
||
copy { | ||
from inputFiles | ||
into outputDir | ||
} | ||
} | ||
} | ||
|
||
asciidoctorj { | ||
noDefaultRepositories = true | ||
} | ||
|
||
asciidoctor { | ||
sourceDir "${buildDir}/tmp/asciidoctorSrc" | ||
sources { | ||
include 'README.asciidoc' | ||
} | ||
|
||
backends 'html5', 'docbook' | ||
options doctype : 'article', | ||
ruby : 'erubis' | ||
attributes 'latestRevision' : project.version, | ||
'toc':'left', | ||
'toclevels':'2', | ||
'source-highlighter' : 'coderay', | ||
'icons': 'font', | ||
'setanchors':'true', | ||
'idprefix':'asciidoc_', | ||
'idseparator':'-', | ||
'docinfo1':'true' | ||
} | ||
|
||
asciidoctor.dependsOn copyAsciiDoc | ||
|
||
jacocoTestReport { | ||
reports { | ||
xml.enabled = true // coveralls plugin depends on xml format report | ||
|
@@ -127,6 +81,13 @@ task sourceJar(type: Jar) { | |
from sourceSets.main.allSource | ||
} | ||
|
||
|
||
artifacts { | ||
archives jar | ||
archives sourceJar | ||
archives groovydocJar | ||
} | ||
|
||
publishing { | ||
publications { | ||
intershopMvn(MavenPublication) { | ||
|
@@ -140,75 +101,89 @@ publishing { | |
classifier "javadoc" | ||
} | ||
|
||
artifact(new File(buildDir, 'asciidoc/html5/README.html')) { | ||
classifier 'reference' | ||
} | ||
|
||
artifact(new File(buildDir, 'asciidoc/docbook/README.xml')) { | ||
classifier = 'docbook' | ||
} | ||
|
||
pom.withXml { | ||
def Node root = asNode(); | ||
def root = asNode(); | ||
root.appendNode('name', project.name) | ||
root.appendNode('description', project.description) | ||
root.appendNode('url', "https:/gitlab.intershop.de/IntershopGradlePlugins/${project.name}") | ||
|
||
def scm = root.appendNode( 'scm' ) | ||
scm.appendNode( 'url', "https://gitlab.intershop.de/IntershopGradlePlugins/${project.name}") | ||
scm.appendNode( 'connection', "scm:git:https://gitlab.intershop.de/IntershopGradlePlugins/${project.name}.git") | ||
def organisation = root.appendNode( 'organization' ) | ||
organisation.appendNode("name", "Intershop Communications AG") | ||
organisation.appendNode("url", "http://intershop.com") | ||
|
||
def org = root.appendNode( 'organization' ) | ||
org.appendNode( 'name', 'Intershop Communications' ) | ||
org.appendNode( 'url', 'http://intershop.com' ) | ||
def scm = root.appendNode( 'scm' ) | ||
scm.appendNode( 'url', "https://github.com/IntershopCommunicationsAG/${project.name}") | ||
scm.appendNode( 'connection', "[email protected]:IntershopCommunicationsAG/${project.name}.git") | ||
scm.appendNode( 'developerConnection', "[email protected]:IntershopCommunicationsAG/${project.name}.git") | ||
|
||
def license = root.appendNode( 'licenses' ).appendNode( 'license' ); | ||
def license = root.appendNode( 'licenses' ).appendNode( 'license' ) | ||
license.appendNode( 'name', 'Apache License, Version 2.0' ) | ||
license.appendNode( 'url', 'http://www.apache.org/licenses/LICENSE-2.0' ) | ||
license.appendNode( 'url', 'http://www.apache.org/licenses/LICENSE-2.0.txt') | ||
license.appendNode( 'distribution', 'repo' ) | ||
|
||
def developer = root.appendNode('developers').appendNode( 'developer' ) | ||
developer.appendNode( 'id', 'm-raab' ) | ||
developer.appendNode( 'name', 'M. Raab' ) | ||
developer.appendNode( 'email', '[email protected]' ) | ||
|
||
def pomFile = file("${project.buildDir}/generated-pom.xml") | ||
writeTo(pomFile) | ||
def pomAscFile = signing.sign(pomFile).signatureFiles[0] | ||
artifact(pomAscFile) { | ||
classifier = null | ||
extension = 'pom.asc' | ||
} | ||
} | ||
|
||
// create the signed artifacts | ||
project.tasks.signArchives.signatureFiles.each { | ||
artifact(it) { | ||
def matcher = it.file =~ /-(sources|javadoc)\.(jar)\.asc$/ | ||
def ref_matcher = it.file =~ /\.html\.asc$/ | ||
def doc_matcher = it.file =~ /\.xml\.asc$/ | ||
if (matcher.find()) { | ||
classifier = matcher.group(1) | ||
extension = "jar.asc" | ||
} else { | ||
if(ref_matcher.find()) { | ||
classifier = 'reference' | ||
extension = 'html.asc' | ||
} | ||
else if(doc_matcher.find()) { | ||
classifier = 'docbook' | ||
extension = 'xml.asc' | ||
} else { | ||
classifier = null | ||
extension = 'jar.asc' | ||
} | ||
} | ||
|
||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
publish.dependsOn asciidoctor | ||
|
||
bintray { | ||
user = System.getenv('BINTRAY_USER') | ||
key = System.getenv('BINTRAY_KEY') | ||
pkg { | ||
repo = 'maven' | ||
name = project.name | ||
userOrg = 'intershopcommunicationsag' | ||
|
||
licenses = ['Apache-2.0'] | ||
vcsUrl = "https://github.com/IntershopCommunicationsAG/${project.name}" | ||
|
||
desc = project.description | ||
websiteUrl = "https://github.com/IntershopCommunicationsAG/${project.name}" | ||
issueTrackerUrl = "https://github.com/IntershopCommunicationsAG/${project.name}/issues" | ||
|
||
labels = ['intershop', 'gradle', 'plugin', 'build', 'javacc'] | ||
publicDownloadNumbers = true | ||
|
||
version { | ||
name = project.version | ||
desc = "${project.description} ${project.version}" | ||
released = new Date() | ||
vcsTag = project.version | ||
repositories { | ||
maven { | ||
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2" | ||
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots" | ||
url = uri(version.toString().endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl) | ||
credentials { | ||
username = sonatypeUsername | ||
password = sonatypePassword | ||
} | ||
} | ||
|
||
publications = ['intershopMvn'] | ||
} | ||
} | ||
|
||
bintrayUpload.dependsOn asciidoctor | ||
signing { | ||
sign configurations.archives | ||
} | ||
|
||
pluginBundle { | ||
website = "https://github.com/IntershopCommunicationsAG/${project.name}" | ||
vcsUrl = "https://github.com/IntershopCommunicationsAG/${project.name}" | ||
description = project.description | ||
tags = ['intershop', 'gradle', 'plugin', 'build', 'javacc'] | ||
tags = ['intershop', 'build', 'javacc'] | ||
|
||
plugins { | ||
escrowPlugin { | ||
|
@@ -226,5 +201,5 @@ dependencies { | |
} | ||
|
||
repositories { | ||
jcenter() | ||
mavenCentral() | ||
} |
Oops, something went wrong.