-
Notifications
You must be signed in to change notification settings - Fork 9
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 #23 from pseudoankit/publish-maven-central-v2
Publish maven central via nexus plugin
- Loading branch information
Showing
4 changed files
with
75 additions
and
82 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,31 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
- name: Check | ||
run: ./gradlew check --stacktrace | ||
|
||
- name: Publish Artifact | ||
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --max-workers=1 --stacktrace | ||
env: | ||
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} | ||
OSS_USERNAME: ${{ secrets.OSS_USERNAME }} | ||
OSS_PASSWORD: ${{ secrets.OSS_PASSWORD }} | ||
OSS_STAGING_PROFILE_ID: ${{ secrets.OSS_STAGING_PROFILE_ID }} | ||
OSS_SIGNING_KEY_ID: ${{ secrets.OSS_SIGNING_KEY_ID }} | ||
OSS_SIGNING_PASSWORD: ${{ secrets.OSS_SIGNING_PASSWORD }} | ||
OSS_SIGNING_KEY: ${{ secrets.OSS_SIGNING_KEY }} |
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
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
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 |
---|---|---|
|
@@ -3,36 +3,46 @@ apply plugin: 'signing' | |
|
||
ext { | ||
GROUP_ID = "io.github.pseudoankit" | ||
VERSION_NAME = "1.0.3" | ||
VERSION = (System.getenv("RELEASE_TAG_NAME") ?: "SNAPSHOT").replace("v", "") | ||
|
||
POM_DESCRIPTION = "Compose library to add coachmark" | ||
POM_URL = "https://github.com/pseudoankit/coachmark" | ||
POM_SCM_CONNECTION = "scm:[email protected]:pseudoankit/coachmark.git" | ||
|
||
OSS_USERNAME = System.getenv("OSS_USERNAME") | ||
OSS_PASSWORD = System.getenv("OSS_PASSWORD") | ||
SITE_URL = 'https://github.com/pseudoankit/coachmark' | ||
GIT_URL = 'https://github.com/pseudoankit/coachmark.git' | ||
|
||
POM_DESCRIPTION = "Compose library to add coachmark" | ||
POM_URL = SITE_URL | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys( | ||
System.getenv("SIGNING_KEY_ID"), | ||
System.getenv("SIGNING_KEY"), | ||
System.getenv("SIGNING_PASSWORD"), | ||
System.getenv("OSS_SIGNING_KEY_ID"), | ||
System.getenv("OSS_SIGNING_KEY"), | ||
System.getenv("OSS_SIGNING_PASSWORD"), | ||
) | ||
sign publishing.publications | ||
} | ||
|
||
// If you want to publish your sources as well | ||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
from android.sourceSets.main.java.srcDirs | ||
from android.sourceSets.main.kotlin.srcDirs | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
} | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
|
||
from components.release | ||
|
||
groupId GROUP_ID | ||
artifactId ARTIFACT_ID | ||
version VERSION_NAME | ||
version VERSION | ||
|
||
from components.release | ||
artifact androidSourcesJar | ||
|
||
pom { | ||
name = ARTIFACT_ID | ||
|
@@ -44,85 +54,23 @@ afterEvaluate { | |
url = "https://www.apache.org/licenses/LICENSE-2.0.txt" | ||
} | ||
} | ||
scm { | ||
connection = POM_SCM_CONNECTION | ||
developerConnection = POM_SCM_CONNECTION | ||
url = POM_URL | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'pseudoankit' | ||
name = 'Ankit Kumar' | ||
email = '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
name = "SonatypeSnapshot" | ||
|
||
// def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
// def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
// url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
|
||
credentials { | ||
username OSS_USERNAME | ||
password OSS_PASSWORD | ||
} | ||
} | ||
|
||
maven { | ||
name = "sonatype" | ||
|
||
// def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
// def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
// url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
|
||
credentials { | ||
username OSS_USERNAME | ||
password OSS_PASSWORD | ||
scm { | ||
connection = GIT_URL | ||
developerConnection = GIT_URL | ||
url = SITE_URL | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task androidJavadoc(type: Javadoc) { | ||
source = android.sourceSets.main.java.srcDirs | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
android.libraryVariants.all { variant -> | ||
if (variant.name == 'release') { | ||
owner.classpath += variant.javaCompileProvider.get().classpath | ||
} | ||
} | ||
|
||
exclude '**/R.html', '**/R.*.html', '**/index.html' | ||
options.encoding 'utf-8' | ||
options { | ||
addStringOption 'docencoding', 'utf-8' | ||
addStringOption 'charset', 'utf-8' | ||
links 'https://docs.oracle.com/javase/7/docs/api/' | ||
links 'https://d.android.com/reference' | ||
links 'https://developer.android.com/reference/androidx/' | ||
} | ||
} | ||
|
||
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { | ||
archiveClassifier.set('javadoc') | ||
from androidJavadoc.destinationDir | ||
|
||
preserveFileTimestamps = false | ||
reproducibleFileOrder = true | ||
} | ||
|
||
task javaSourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
from android.sourceSets.main.java.srcDirs | ||
|
||
preserveFileTimestamps = false | ||
reproducibleFileOrder = true | ||
} |