From 19dea84723e1163c341bc3b16ada1a5151a93a58 Mon Sep 17 00:00:00 2001 From: "i.o.novikov" Date: Wed, 16 Feb 2022 20:29:39 +0300 Subject: [PATCH 1/4] update gradle to 6.5 & android gradle plugin to 3.6.4 --- build.gradle | 2 +- gradle.properties | 1 + gradle/publish-lib.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index e4f4f15..76884e6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.6.4' } } diff --git a/gradle.properties b/gradle.properties index 0efeb03..e7bc25d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,6 +15,7 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true +android.useAndroidX=true VERSION_NAME=1.2.1 VERSION_CODE=11 diff --git a/gradle/publish-lib.gradle b/gradle/publish-lib.gradle index 053d347..37f7492 100755 --- a/gradle/publish-lib.gradle +++ b/gradle/publish-lib.gradle @@ -35,11 +35,11 @@ def getSnapshotRepositoryUrl() { } def getRepositoryUsername() { - return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : '' + return hasProperty('ossrhUsername') ? ossrhUsername : '' } def getRepositoryPassword() { - return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : '' + return hasProperty('ossrhPassword') ? ossrhPassword : '' } afterEvaluate { project -> diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 842baab..e814fef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip \ No newline at end of file From 75e06e1681039b021e0dad1347b57311a51b5097 Mon Sep 17 00:00:00 2001 From: "i.o.novikov" Date: Wed, 16 Feb 2022 20:30:35 +0300 Subject: [PATCH 2/4] add github workflow --- .github/workflows/merge_request.yml | 12 ++++++++++++ .github/workflows/publish.yml | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/merge_request.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/merge_request.yml b/.github/workflows/merge_request.yml new file mode 100644 index 0000000..476e2ed --- /dev/null +++ b/.github/workflows/merge_request.yml @@ -0,0 +1,12 @@ +name: merge request + +on: + pull_request: + branches: + - 'master' + +jobs: + check: + uses: tinkoff-mobile-tech/workflows/.github/workflows/android_lib.merge_request.yml@v1 + with: + java_version: '8' \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..734bc0a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,13 @@ +name: publish + +on: + workflow_dispatch: + +jobs: + publish: + uses: tinkoff-mobile-tech/workflows/.github/workflows/android_lib.publish.yml@v1 + with: + java_version: '8' + secrets: + gpg_key: ${{ secrets.GPG_KEY }} + sign_ossrh_gradle_properties: ${{ secrets.SIGN_OSSRH_GRADLE_PROPERTIES }} From 01585eb561bdf1b6f62605638cbf11d110636dac Mon Sep 17 00:00:00 2001 From: "i.o.novikov" Date: Tue, 22 Feb 2022 12:59:57 +0300 Subject: [PATCH 3/4] migrate to gradle plugin "maven" --- gradle/publish-lib.gradle | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/gradle/publish-lib.gradle b/gradle/publish-lib.gradle index 4047929..dd9c17b 100755 --- a/gradle/publish-lib.gradle +++ b/gradle/publish-lib.gradle @@ -14,35 +14,36 @@ * limitations under the License. */ apply plugin: 'maven-publish' +apply plugin: 'signing' -def getEnvValueOrEmpty(String key) { - String value = System.getenv(key) - return value != null ? value : "" -} +def isAndroidLibrary = project.extensions.findByName('android') != null -def getReleaseRepository() { - return getEnvValueOrEmpty("PRIVATE_NEXUS_RELEASE_URL") +def getReleaseRepositoryUrl() { + return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL + : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" } -def getSnapshotRepository() { - return getEnvValueOrEmpty("PRIVATE_NEXUS_SNAPSHOT_URL") +def getSnapshotRepositoryUrl() { + return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL + : "https://oss.sonatype.org/content/repositories/snapshots/" } def getRepositoryUsername() { - return getEnvValueOrEmpty("PRIVATE_NEXUS_USER") + return hasProperty('ossrhUsername') ? ossrhUsername : '' } def getRepositoryPassword() { - return getEnvValueOrEmpty("PRIVATE_NEXUS_PASSWORD") + return hasProperty('ossrhPassword') ? ossrhPassword : '' } -afterEvaluate { project -> +afterEvaluate { publishing { publications { - mavenAar(MavenPublication) { - from components.release + release(MavenPublication) { + from isAndroidLibrary ? components.release : components.java groupId GROUP version versionName + artifactId POM_ARTIFACT_ID afterEvaluate { artifact sourcesJar artifact javadocJar @@ -73,10 +74,9 @@ afterEvaluate { project -> } } } - repositories { maven { - url isRelease ? getReleaseRepository() : getSnapshotRepository() + url isRelease ? getReleaseRepositoryUrl() : getSnapshotRepositoryUrl() credentials { username = getRepositoryUsername() password = getRepositoryPassword() @@ -107,4 +107,9 @@ afterEvaluate { project -> archiveClassifier.set('javadoc') from "$buildDir/docs/javadoc" } -} + + signing { + required { isRelease } + sign publishing.publications.release + } +} \ No newline at end of file From 844532471b4d70797e382f6488e220c54e1d1976 Mon Sep 17 00:00:00 2001 From: "i.o.novikov" Date: Tue, 22 Feb 2022 13:11:18 +0300 Subject: [PATCH 4/4] use java 11 for publsih --- .github/workflows/publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 734bc0a..115dce8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,8 +6,6 @@ on: jobs: publish: uses: tinkoff-mobile-tech/workflows/.github/workflows/android_lib.publish.yml@v1 - with: - java_version: '8' secrets: gpg_key: ${{ secrets.GPG_KEY }} sign_ossrh_gradle_properties: ${{ secrets.SIGN_OSSRH_GRADLE_PROPERTIES }}