Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: removed artifactory, changes for maven central release #8

Merged
merged 4 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ workflow:
build-and-publish:
stage: build
variables:
PRIMER_ANDROID_ARTIFACTORY_DEPLOY_USERNAME: $ARTIFACTORY_DEPLOY_USERNAME
PRIMER_ANDROID_ARTIFACTORY_DEPLOY_PASSWORD: $ARTIFACTORY_DEPLOY_PASSWORD
ORG_GRADLE_PROJECT_mavenCentralUsername: $MAVEN_CENTRAL_USERNAME
ORG_GRADLE_PROJECT_mavenCentralPassword: $MAVEN_CENTRAL_PASSWORD
ORG_GRADLE_PROJECT_signingInMemoryKey: $SONARTYPE_GPG_EXPORTED
ORG_GRADLE_PROJECT_signingInMemoryKeyId: $SONATYPE_KEY_ID
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: $SONATYPE_PASSWORD
script:
- mkdir ./.gradle/
- ./gradlew assembleRelease --stacktrace && ./gradlew artifactoryPublish
- echo nexusOptions.repositoryPassword=$NEXUS_PWD > ./.gradle/gradle.properties
- echo nexusOptions.repositoryUsername=primerapi >> ./.gradle/gradle.properties
- echo nexusOptions.stagingProfile=io.primer >> ./.gradle/gradle.properties
- ./gradlew publish --stacktrace && ./gradlew closeAndReleaseRepository
rules:
- if: $CI_COMMIT_TAG
artifacts:
paths:
- primer-ipay88-sdk-android/ipay88/build/outputs/aar/
- ipay88/build/outputs/aar/
when: manual
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ buildscript {
plugins {
alias libs.plugins.android.library apply false
alias libs.plugins.kotlin.android apply false
alias libs.plugins.jfrog.artifactory apply false
alias libs.plugins.ktlint apply false
alias libs.plugins.maven.publish apply false
}
65 changes: 7 additions & 58 deletions config/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,61 +1,10 @@
apply plugin: "maven-publish"
apply plugin: "com.vanniktech.maven.publish"

publishing {
publications {
aar(MavenPublication) {
groupId "${GROUP}"
artifactId "${POM_ARTIFACT_ID}"
version "${VERSION_NAME}"
artifact file("$buildDir/outputs/aar/ipay88-release.aar")
pom.withXml {
// for dependencies and exclusions
def dependenciesNode = asNode().appendNode('dependencies')
def configurationNames = ["implementation", "api", "runtimeOnly"]
configurationNames.each { confName ->
configurations[confName].allDependencies.each {
if (it.group != null && it.name != null) {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
if (it.hasProperty('excludeRules') && it.excludeRules.size() > 0) {
def exclusionsNode = dependencyNode.appendNode('exclusions')
it.excludeRules.each { rule ->
def exclusionNode = exclusionsNode.appendNode('exclusion')
exclusionNode.appendNode('groupId', rule.group)
exclusionNode.appendNode('artifactId', rule.module)
}
}
}
}
}
}
allprojects {
def excludedTasks = Arrays.asList("javaSourcesJar", "javaDocReleaseGeneration")
tasks.configureEach { task ->
if (excludedTasks.stream().any { task.name.contains(it) }) {
task.enabled = false
}
}
}

assemble.finalizedBy(artifactoryPublish)

artifactory {
contextUrl = "${ARTIFACTORY_CONTEXT_URL}"
publish {
repository {
repoKey = "${ARTIFACTORY_REPO_KEY}"
username = System.getenv("PRIMER_ANDROID_ARTIFACTORY_DEPLOY_USERNAME")
password = System.getenv("PRIMER_ANDROID_ARTIFACTORY_DEPLOY_PASSWORD")
maven = true
}
defaults {
publications(publishing.publications.aar)
publishArtifacts = true
}
}
resolve {
repository {
repoKey = "${ARTIFACTORY_REPO_KEY}"
username = System.getenv("PRIMER_ANDROID_ARTIFACTORY_DEPLOY_USERNAME")
password = System.getenv("PRIMER_ANDROID_ARTIFACTORY_DEPLOY_PASSWORD")
maven = true
}
}
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ POM_DEVELOPER_ID=primer-api
POM_DEVELOPER_NAME=Primer Developers
POM_DEVELOPER_URL=https://github.com/primer-io

ARTIFACTORY_CONTEXT_URL=https://primer.jfrog.io/artifactory
ARTIFACTORY_REPO_KEY=primer-android
SONATYPE_HOST=S01
RELEASE_SIGNING_ENABLED=true

android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ipay88 = "1.0.1"
# plugin versions
androidGradlePlugin = "8.1.3"
ktlint = "11.6.1"
artifactory = "4.24.15"
mavenPublish = "0.22.0"

[libraries]
android-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
Expand All @@ -16,5 +16,5 @@ ipay88 = { group = "io.primer", name = "ipay88-my", version.ref = "ipay88" }
[plugins]
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
jfrog-artifactory = {id = "com.jfrog.artifactory", version.ref = "artifactory"}
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
6 changes: 4 additions & 2 deletions ipay88/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
alias libs.plugins.android.library
alias libs.plugins.kotlin.android
alias libs.plugins.jfrog.artifactory
alias libs.plugins.ktlint
alias libs.plugins.maven.publish
}

android {
Expand Down Expand Up @@ -40,5 +40,7 @@ android {

dependencies {
implementation libs.android.appcompat
implementation libs.ipay88
api libs.ipay88
}

apply from: "$rootDir/config/publish.gradle"