diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c1d7c74 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Publish package to the Maven Central Repository +on: + release: + types: [created] +jobs: + publish: + environment: + name: Central Repository Deployment + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + - name: Publish package + working-directory: ./support + run: ./gradlew uploadArchives + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.OSSRH_GPG_SECRET_KEY_ID }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} diff --git a/.gitignore b/.gitignore index cb44d58..9c107b3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /tmp/ .idea /*.gem +.gradle diff --git a/README.md b/README.md index ede6181..5047ebf 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ And then execute: The generated code depends on the com.shopify.graphql.support java package. This can be added to a gradle project by adding the following -jCenter dependancy to you `build.gradle` file: +dependancy to you `build.gradle` file: - compile 'com.shopify.graphql.support:support:0.2.0' + implementation 'com.shopify.graphql.support:support:0.2.1' ## Usage diff --git a/support/build.gradle b/support/build.gradle index 9863ac2..e8ac1e3 100644 --- a/support/build.gradle +++ b/support/build.gradle @@ -1,9 +1,6 @@ buildscript { repositories { - jcenter() - } - dependencies { - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' + mavenCentral() } } diff --git a/support/gradle/wrapper/gradle-wrapper.properties b/support/gradle/wrapper/gradle-wrapper.properties index 2d80b69..4d9ca16 100644 --- a/support/gradle/wrapper/gradle-wrapper.properties +++ b/support/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/support/graphql.java.gen.build.gradle b/support/graphql.java.gen.build.gradle index a1bcea5..59032cb 100644 --- a/support/graphql.java.gen.build.gradle +++ b/support/graphql.java.gen.build.gradle @@ -1,18 +1,12 @@ -def VERSION_NAME = '0.2.0' - -buildscript { - repositories { - jcenter() - } -} +def VERSION_NAME = '0.2.1' repositories { - jcenter() + mavenCentral() } apply plugin: 'java' apply plugin: 'maven' -apply plugin: 'com.jfrog.bintray' +apply plugin: 'signing' dependencies { implementation 'com.google.code.gson:gson:2.8.5' @@ -35,8 +29,6 @@ test { } } -version = VERSION_NAME - task sourcesJar(type: Jar) { from sourceSets.main.allSource classifier = 'sources' @@ -65,60 +57,65 @@ ext { licenseName = 'The MIT License' licenseUrl = 'https://opensource.org/licenses/MIT' allLicenses = ["MIT"] + + author = 'Shopify Inc.' } group = publishedGroupId +archivesBaseName = artifact +version = VERSION_NAME + +signing { + required { gradle.taskGraph.hasTask("uploadArchives") } + def signingKeyId = findProperty("signingKeyId") + def signingKey = findProperty("signingKey") + def signingPassword = findProperty("signingPassword") + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign configurations.archives +} + +uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: System.getenv("OSSRH_USERNAME"), password: System.getenv("OSSRH_PASSWORD")) + } + + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: System.getenv("OSSRH_USERNAME"), password: System.getenv("OSSRH_PASSWORD")) + } + + pom { + project { + groupId project.ext.publishedGroupId + artifactId project.ext.artifact -install { - repositories.mavenInstaller { - // Generates POM.xml with proper parameters - pom { - project { - groupId publishedGroupId - artifactId artifact - - name libraryName - description libraryDescription - url siteUrl - - licenses { - license { - name licenseName - url licenseUrl + name project.ext.libraryName + description project.ext.libraryDescription + url project.ext.siteUrl + + developers { + developer { + name project.ext.author + } } - } - scm { - connection gitUrl - developerConnection gitUrl - url siteUrl + licenses { + license { + name project.ext.licenseName + url project.ext.licenseUrl + } + } + + scm { + connection = project.ext.gitUrl + developerConnection = project.ext.gitUrl + url = project.ext.siteUrl + } } } } } } - -bintray { - /* - These values can be found on https://bintray.com/profile/edit - BINTRAY_USER : your personal profile name (from "Your Profile") - BINTRAY_KEY : found on the left menu, under "API Key" - */ - user = System.getenv('BINTRAY_USER') - key = System.getenv('BINTRAY_KEY') - - configurations = ['archives'] - publish = true - pkg { - userOrg = 'shopify' - repo = 'shopify-java' - name = libraryName - desc = libraryDescription - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = allLicenses - version { - name = VERSION_NAME - } - } -}