Skip to content

Commit

Permalink
feat: apply Maven changes to v1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindavee committed Jun 24, 2021
1 parent 13f6d3d commit 72296d9
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 38 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/bintray.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Build and Sign with Gradle
run: ./gradlew build -x signArchives
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish to Maven Central

on:
push:
tags:
- 'v*'

jobs:
publish:
name: Publish to Maven Central
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout
- name: Set up Java and Maven Central Repository
uses: actions/setup-java@v1
with:
java-version: 1.11
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- id: install-secret-key
name: Add secring.gpg
run: echo ${{ secrets.OSSRH_GPG }} | base64 -d > secring.gpg
- id: build-and-sign
name: Build and Sign with Gradle
run: ./gradlew build -x signArchives
- id: publish-to-central
name: Publish to central repository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
run: ./gradlew --stop && ./gradlew uploadArchives -Psigning.password=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -Psigning.secretKeyRingFile=../secring.gpg -Psigning.keyId=${{ secrets.OSSRH_GPG_SECRET_KEY_ID }} --stacktrace --info
- name: Close and release repository
run: ./gradlew --stop && ./gradlew closeAndReleaseRepository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,5 @@ bin/
## OS X
##############################
.DS_Store

*.gpg
11 changes: 11 additions & 0 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
17 changes: 10 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -29,14 +30,16 @@ ext {

libraryDescription = 'Easily connect to Xendit with this library.'

siteUrl = 'https://github.com/xendit/xendit-java-library'
gitUrl = 'https://github.com/xendit/xendit-java-library.git'
siteUrl = 'https://github.com/xendit/xendit-java'
gitUrl = 'https://github.com/xendit/xendit-java.git'

developerId = 'hakiemaul'
developerName = 'Aulia Hakiem.'
developerEmail = 'hakiem@xendit.co'
developerId = '0505gonzalez'
developerName = 'Juan Gonzalez.'
developerEmail = 'juan@xendit.co'

licenseName = 'MIT'
licenseUrl = ''
licenseUrl = 'https://opensource.org/licenses/MIT'
allLicenses = ["MIT"]
}
}

apply plugin: 'io.codearte.nexus-staging'
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip
106 changes: 103 additions & 3 deletions xendit-java-lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'java'
id 'maven'
id 'signing'
id 'maven-publish'
id 'com.jfrog.bintray'
id "com.diffplug.gradle.spotless" version "3.27.1"
Expand Down Expand Up @@ -31,8 +32,19 @@ dependencies {
testImplementation group: "org.mockito", name: "mockito-core", version:"3.1.0"
}

task sourceJar(type: Jar) {
from sourceSets.main.allJava
task packageJavadoc(type: Jar, dependsOn: 'javadoc') {
from javadoc.destinationDir
classifier = 'javadoc'
}

task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}

artifacts {
archives sourcesJar
archives packageJavadoc
}

publishing {
Expand All @@ -42,7 +54,7 @@ publishing {
artifactId artifact

from components.java
artifact sourceJar {
artifact sourcesJar {
classifier "sources"
}
pom {
Expand Down Expand Up @@ -76,6 +88,13 @@ def bintrayUser = System.getenv('BINTRAY_USER')
def bintrayAPIKey = System.getenv('BINTRAY_API_KEY')
def bintrayGPGPassword = System.getenv('BINTRAY_GPG_PASSWORD')

String ossrhUser = System.getenv('OSSRH_USERNAME')
String ossrhPassword = System.getenv('OSSRH_PASSWORD')

signing {
sign configurations.archives
}

bintray {
user = bintrayUser
key = bintrayAPIKey
Expand Down Expand Up @@ -110,4 +129,85 @@ spotless {
java {
googleJavaFormat()
}
}

publishing {
publications {
Production(MavenPublication) {
artifact("$buildDir/outputs/jar/xendit-java-release.jar") // replace with your library name
groupId this.group
artifactId 'xendit-java' // replace with your library artifact id
version this.version

pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')

// Iterate over the implementation dependencies (we don't want the test ones),
// adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included in the pom.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}


uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUser, password: ossrhPassword)
}

snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUser, password: ossrhPassword)
}

pom.project {
name bintrayName
packaging 'jar'
// optionally artifactId can be defined here
description libraryDescription
url siteUrl

scm {
connection gitUrl
developerConnection gitUrl
url gitUrl
}

licenses {
license {
name licenseName
url licenseUrl
}
}

developers {
developer {
id developerId
name developerName
email developerEmail
}
}
}
}
}
}

nexusStaging {
serverUrl = 'https://s01.oss.sonatype.org/service/local/'
username = ossrhUser
password = ossrhPassword
repositoryDescription = 'Closed and released using gradle script'
packageGroup = this.group
}

0 comments on commit 72296d9

Please sign in to comment.