diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9cedc57..bc58aa1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ name: Release on: push: - branches: [ main ] + branches: [ main, test_changes] workflow_dispatch: jobs: @@ -35,8 +35,8 @@ jobs: gpg --quiet --output $GITHUB_WORKSPACE/release.gpg --dearmor ./release.asc SONATYPE_PASSWORD_ESCAPED=$(printf '%s\n' "$SONATYPE_PASSWORD" | sed -e 's/[\/&]/\\&/g') - sed -i -e "s,sonatypeUsername=,sonatypeUsername=$SONATYPE_USERNAME,g" gradle.properties - sed -i -e "s,sonatypePassword=,sonatypePassword=$SONATYPE_PASSWORD_ESCAPED,g" gradle.properties + sed -i -e "s,mavenCentralUsername=,mavenCentralUsername=$SONATYPE_USERNAME,g" gradle.properties + sed -i -e "s,mavenCentralPassword=,mavenCentralPassword=$SONATYPE_PASSWORD_ESCAPED,g" gradle.properties sed -i -e "s,githubPassword=,githubPassword=$GITHUB_PASSWORD,g" gradle.properties sed -i -e "s,signing.keyId=,signing.keyId=$GPG_KEY_ID,g" gradle.properties sed -i -e "s,signing.password=,signing.password=$GPG_PASSWORD,g" gradle.properties diff --git a/build.gradle b/build.gradle index d3f28b9..6dfd195 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,4 @@ + buildscript { // Configuration for building repositories { mavenCentral() @@ -7,7 +8,7 @@ buildscript { // Configuration for building plugins { id 'java-library' id 'maven-publish' - id 'signing' + id "com.vanniktech.maven.publish" version "0.34.0" } apply plugin: 'java' // standard Java tasks @@ -29,60 +30,45 @@ repositories { // repositories for Jar's you access in your code mavenCentral() } -publishing { - publications { - authLib(MavenPublication) { - pom { - name = 'Fleet Engine Auth Library' - description = 'Provides a set of tools to simplify the Fleet Engine setup process.' - url = 'https://github.com/googlemaps/java-fleetengine-auth' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - organization { - name = 'Google, Inc.' - url = 'http://www.google.com' - } - issueManagement { - system = 'GitHub Issues' - url = 'http://github.com/googlemaps/java-fleetengine-auth/issues' - } - scm { - connection = 'scm:git:git://github.com/googlemaps/java-fleetengine-auth.git' - developerConnection = 'scm:git:ssh://github.com/googlemaps/java-fleetengine-auth.git' - url = 'http://github.com/googlemaps/java-fleetengine-auth/' - tag = 'HEAD' - } - developers { - developer { - id = 'danielfbright' - name = 'Daniel Bright' - } - } +mavenPublishing { + publishToMavenCentral() + signAllPublications() + pom { + name = "Fleet Engine Auth Library" + description = "Provides a set of tools to simplify the Fleet Engine setup process." + url = "https://github.com/googlemaps/java-fleetengine-auth" + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt" } - groupId group - artifactId project.ext.artifactId - version version - from components.java } - } - repositories { - maven { - name = "mavencentral" - url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - credentials { - username sonatypeUsername - password sonatypePassword + organization { + name = 'Google, Inc.' + url = 'http://www.google.com' + } + issueManagement { + system = 'GitHub Issues' + url = 'http://github.com/googlemaps/java-fleetengine-auth/issues' + } + scm { + connection = 'scm:git:git://github.com/googlemaps/java-fleetengine-auth.git' + developerConnection = 'scm:git:ssh://github.com/googlemaps/java-fleetengine-auth.git' + url = 'http://github.com/googlemaps/java-fleetengine-auth/' + tag = 'HEAD' + } + developers { + developer { + id.set("google") + name.set("Google Inc.") } } } } dependencies { - compile 'jstl:jstl:1.2' + implementation 'jstl:jstl:1.2' annotationProcessor 'com.google.auto.value:auto-value:1.6.2' @@ -100,32 +86,3 @@ dependencies { testImplementation 'com.google.truth:truth:1.1' testImplementation 'org.mockito:mockito-core:3.12.4' } - -signing { - sign publishing.publications.authLib -} - -task javadocJar(type: Jar) { - classifier = 'javadoc' - from 'build/docs/javadoc' -} - -task sourcesJar(type: Jar) { - from sourceSets.main.allSource - classifier = 'sources' -} - -artifacts { - archives jar - archives javadocJar - archives sourcesJar -} - -java { - withJavadocJar() - withSourcesJar() -} - - -compileJava.options.encoding = 'UTF-8' -javadoc.options.encoding = 'UTF-8' diff --git a/gradle.properties b/gradle.properties index d2f4230..852dc23 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,6 +19,9 @@ signing.keyId= signing.password= signing.secretKeyRingFile= -sonatypeUsername= -sonatypePassword= +mavenCentralUsername= +mavenCentralPassword= + +# Add a property to enable automatic release to Maven Central (optional, but good for CI) +# If true, publishToMavenCentral will also close and release the staging repository diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a2bf131..a595206 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/sample/build.gradle b/sample/build.gradle index c143c89..053b4db 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -30,15 +30,6 @@ run { systemProperties System.getProperties() standardInput = System.in } - -sourceSets.all { - configurations.getByName(runtimeClasspathConfigurationName) { - attributes.attribute(Attribute.of("org.gradle.jvm.environment", String), "standard-jvm") - } - configurations.getByName(compileClasspathConfigurationName) { - attributes.attribute(Attribute.of("org.gradle.jvm.environment", String), "standard-jvm") - } -} dependencies { annotationProcessor 'com.google.auto.value:auto-value:1.6.2' diff --git a/sample/gradle/wrapper/gradle-wrapper.properties b/sample/gradle/wrapper/gradle-wrapper.properties index 6ce793f..a595206 100644 --- a/sample/gradle/wrapper/gradle-wrapper.properties +++ b/sample/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists