Skip to content

Commit c108524

Browse files
authored
ANDROID-11221 Update plugin to upload to mavencentral (#6)
1 parent 025d908 commit c108524

File tree

6 files changed

+36
-44
lines changed

6 files changed

+36
-44
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
name: "Create release"
2-
on:
2+
on:
33
release:
4-
types: [published]
4+
types: [published]
55
jobs:
66
release:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout repo
1010
uses: actions/checkout@v2
11-
11+
1212
- name: Build library
1313
run: 'bash ./gradlew clean :nestedscrollwebview:assembleRelease'
14-
14+
1515
- name: Release library
1616
env:
1717
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
1818
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
1919
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
2020
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
2121
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
22-
run: "bash ./gradlew publishReleasePublicationToSonatypeRepository -DLIBRARY_VERSION=${{ github.event.release.tag_name }}"
23-
24-
- name: Wait 1 minute until the artifacts are ready in maven central
25-
run: sleep 60s
26-
shell: bash
27-
28-
- name: Close and promote staging repository
29-
env:
30-
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
31-
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
32-
run: 'bash ./gradlew closeAndReleaseRepository'
22+
run: "bash ./gradlew publishReleasePublicationToSonatypeRepository -DLIBRARY_VERSION=${{ github.event.release.tag_name }}
23+
--max-workers 1 closeAndReleaseStagingRepository"

.github/workflows/tests.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,12 @@ jobs:
2222
wrapper-cache-enabled: false
2323
dependencies-cache-enabled: false
2424
configuration-cache-enabled: false
25-
arguments: assembleRelease check detekt
25+
arguments: assembleRelease
26+
27+
- name: Run checks
28+
if: success() || failure()
29+
run: ./gradlew check
30+
31+
- name: Run Detekt
32+
if: success() || failure()
33+
run: ./gradlew detekt

build.gradle

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
33
dependencies {
4+
classpath "com.android.tools.build:gradle:7.1.3"
5+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
46
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
57
}
68
}
79

810
plugins {
9-
id 'com.android.application' version '7.2.2' apply false
10-
id 'com.android.library' version '7.2.2' apply false
11-
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
12-
id 'io.gitlab.arturbosch.detekt' version '1.18.1'
11+
id 'com.android.application' version '7.4.2' apply false
12+
id 'com.android.library' version '7.4.2' apply false
13+
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
14+
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' apply false
15+
id 'io.gitlab.arturbosch.detekt' version '1.22.0'
1316
}
1417

1518
detekt {
1619
input = files(rootProject.rootDir)
1720
config = files("$projectDir/detekt.yml")
18-
failFast = true
21+
allRules = true
1922
buildUponDefaultConfig = true
2023

2124
reports {
@@ -30,15 +33,6 @@ task clean(type: Delete) {
3033
delete rootProject.buildDir
3134
}
3235

33-
apply plugin: 'io.codearte.nexus-staging'
34-
35-
nexusStaging {
36-
packageGroup = "com.telefonica"
37-
stagingProfileId = "f7fe7699e57a"
38-
username = System.getenv("MOBILE_MAVENCENTRAL_USER")
39-
password = System.getenv("MOBILE_MAVENCENTRAL_PASSWORD")
40-
}
41-
4236
allprojects {
4337
group = 'com.telefonica.nestedscrollwebview'
4438
if (System.getProperty("SNAPSHOT_VERSION") != null) {
@@ -47,3 +41,4 @@ allprojects {
4741
version = System.getProperty("LIBRARY_VERSION") ?: "undefined"
4842
}
4943
}
44+
apply from: "${rootProject.projectDir}/publish_maven_central.gradle"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Wed Aug 03 11:27:29 CEST 2022
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

mavencentral.gradle

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,6 @@ publishing {
6565
}
6666
}
6767
}
68-
repositories {
69-
maven {
70-
name = "sonatype"
71-
72-
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
73-
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
74-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
75-
credentials {
76-
username System.getenv("MOBILE_MAVENCENTRAL_USER")
77-
password System.getenv("MOBILE_MAVENCENTRAL_PASSWORD")
78-
}
79-
}
80-
}
8168
}
8269

8370
signing {

publish_maven_central.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
2+
3+
nexusPublishing {
4+
repositories {
5+
sonatype {
6+
stagingProfileId = "f7fe7699e57a"
7+
username = System.getenv("MOBILE_MAVENCENTRAL_USER")
8+
password = System.getenv("MOBILE_MAVENCENTRAL_PASSWORD")
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)