Skip to content

Commit dacbabf

Browse files
authored
Merge pull request #2 from Telefonica/publishing
ANDROID-10730 Publishing
2 parents 78e6439 + dd5a1b1 commit dacbabf

File tree

10 files changed

+303
-4
lines changed

10 files changed

+303
-4
lines changed

.github/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
authors:
6+
- tuentisre
7+
categories:
8+
- title: Breaking Changes 🛠
9+
labels:
10+
- breaking-change
11+
- title: New Features 🎉
12+
labels:
13+
- enhancement
14+
- new-feature
15+
- title: Other Changes
16+
labels:
17+
- "*"

.github/workflows/manual_release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Release manually"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
libraryVersion:
6+
description: "Library version"
7+
required: true
8+
jobs:
9+
manual-release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repo
13+
uses: actions/checkout@v2
14+
15+
- name: Build library
16+
run: 'bash ./gradlew clean :nestedscrollwebview:assembleRelease'
17+
18+
- name: Release library manually
19+
env:
20+
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
21+
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
22+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
23+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
24+
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
25+
run: "bash ./gradlew publishReleasePublicationToSonatypeRepository -DLIBRARY_VERSION=${{ github.event.inputs.libraryVersion }}"

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Create release"
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repo
10+
uses: actions/checkout@v2
11+
12+
- name: Build library
13+
run: 'bash ./gradlew clean :nestedscrollwebview:assembleRelease'
14+
15+
- name: Release library
16+
env:
17+
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
18+
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
19+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
20+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
21+
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'

.github/workflows/snapshot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Snapshot"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
snapshotVersion:
6+
description: "Snapshot version"
7+
required: true
8+
jobs:
9+
snapshot:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repo
13+
uses: actions/checkout@v2
14+
15+
- name: Build library
16+
run: 'bash ./gradlew clean :nestedscrollwebview:assembleRelease'
17+
18+
- name: Release snapshot
19+
env:
20+
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
21+
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
22+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
23+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
24+
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
25+
run: "bash ./gradlew publishReleasePublicationToSonatypeRepository -DSNAPSHOT_VERSION=${{ github.event.inputs.snapshotVersion }}"

.github/workflows/tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Tests
2+
on: pull_request
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/[email protected]
9+
10+
- name: Set up JDK 11
11+
uses: actions/setup-java@v2
12+
with:
13+
distribution: 'temurin'
14+
java-version: '11'
15+
16+
## Build all our Build Types at once ##
17+
- name: Build all artifacts
18+
id: buildAllApks
19+
uses: eskatos/[email protected]
20+
with:
21+
gradle-version: current
22+
wrapper-cache-enabled: false
23+
dependencies-cache-enabled: false
24+
configuration-cache-enabled: false
25+
arguments: assembleRelease check detekt

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
# android-nested-scroll-webview
1+
<p>
2+
<img src="https://img.shields.io/badge/Platform-Android-brightgreen" />
3+
<img src="https://maven-badges.herokuapp.com/maven-central/com.telefonica/nestedscrollwebview/badge.png" />
4+
<img src="https://img.shields.io/badge/Support-%3E%3D%20Android%205.0-brightgreen" />
5+
</p>
6+
7+
# Android Nested Scroll WebView
8+
9+
Android WebView implementation for nested scrolling layouts
10+
11+
To include the library add to your app's `build.gradle`:
12+
13+
```gradle
14+
implementation 'com.telefonica:nestedscrollwebview:{version}'
15+
```

build.gradle

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,49 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
buildscript {
3+
dependencies {
4+
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
5+
}
6+
}
7+
28
plugins {
3-
id 'com.android.application' version '7.2.1' apply false
4-
id 'com.android.library' version '7.2.1' apply false
9+
id 'com.android.application' version '7.2.2' apply false
10+
id 'com.android.library' version '7.2.2' apply false
511
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
12+
id 'io.gitlab.arturbosch.detekt' version '1.18.1'
13+
}
14+
15+
detekt {
16+
input = files(rootProject.rootDir)
17+
config = files("$projectDir/detekt.yml")
18+
failFast = true
19+
buildUponDefaultConfig = true
20+
21+
reports {
22+
html.enabled = true
23+
xml.enabled = true
24+
xml.destination = file("$buildDir/reports/detekt/detekt-checkstyle.xml")
25+
html.destination = file("$buildDir/reports/detekt/detekt-report.html")
26+
}
627
}
728

829
task clean(type: Delete) {
930
delete rootProject.buildDir
1031
}
32+
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+
42+
allprojects {
43+
group = 'com.telefonica.nestedscrollwebview'
44+
if (System.getProperty("SNAPSHOT_VERSION") != null) {
45+
version = System.getProperty("SNAPSHOT_VERSION")+"-SNAPSHOT"
46+
} else {
47+
version = System.getProperty("LIBRARY_VERSION") ?: "undefined"
48+
}
49+
}

detekt.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
build:
2+
maxIssues: 0
3+
weights:
4+
complexity: 2
5+
formatting: 1
6+
LongParameterList: 1
7+
comments: 1
8+
9+
complexity:
10+
TooManyFunctions:
11+
active: false
12+
LongMethod:
13+
active: false
14+
LongParameterList:
15+
active: false
16+
17+
empty-blocks:
18+
EmptyFunctionBlock:
19+
active: false
20+
style:
21+
MagicNumber:
22+
active: false
23+
NewLineAtEndOfFile:
24+
active: false
25+
UnusedPrivateMember:
26+
active: false
27+
WildcardImport:
28+
active: false
29+
30+
exceptions:
31+
TooGenericExceptionThrown:
32+
active: false

mavencentral.gradle

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
task sourcesJar(type: Jar) {
2+
archiveClassifier.set('sources')
3+
from android.sourceSets.main.java.srcDirs
4+
}
5+
6+
artifacts {
7+
archives sourcesJar
8+
}
9+
10+
apply plugin: 'maven-publish'
11+
apply plugin: 'signing'
12+
13+
ext {
14+
PUBLISH_GROUP_ID = 'com.telefonica'
15+
PUBLISH_ARTIFACT_ID = 'nestedscrollwebview'
16+
PUBLISH_VERSION = version
17+
18+
PUBLISH_RELEASE_NAME = 'Nested Scroll WebView for Android'
19+
PUBLISH_DESCRIPTION = 'A webView implementation with nested scrolling support'
20+
PUBLISH_REPO_URL = 'https://github.com/Telefonica/android-nested-scroll-webview'
21+
}
22+
23+
publishing {
24+
publications {
25+
release(MavenPublication) {
26+
groupId PUBLISH_GROUP_ID
27+
artifactId PUBLISH_ARTIFACT_ID
28+
version PUBLISH_VERSION
29+
30+
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
31+
artifact sourcesJar
32+
33+
pom {
34+
name = PUBLISH_RELEASE_NAME
35+
description = PUBLISH_DESCRIPTION
36+
url = PUBLISH_REPO_URL
37+
licenses {
38+
license {
39+
name = 'The Apache License, Version 2.0'
40+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
41+
}
42+
}
43+
developers {
44+
developer {
45+
id = 'android-team-telefonica'
46+
name = 'Android Team'
47+
48+
}
49+
}
50+
scm {
51+
connection = 'scm:git:https://github.com/Telefonica/android-nested-scroll-webview.git'
52+
developerConnection = 'scm:git:ssh://https://github.com/Telefonica/android-nested-scroll-webview.git'
53+
url = 'https://github.com/Telefonica/android-nested-scroll-webview/tree/main'
54+
}
55+
withXml {
56+
def dependenciesNode = asNode().appendNode('dependencies')
57+
58+
project.configurations.getByName("implementation").allDependencies.each {
59+
def dependencyNode = dependenciesNode.appendNode('dependency')
60+
dependencyNode.appendNode('groupId', it.group)
61+
dependencyNode.appendNode('artifactId', it.name)
62+
dependencyNode.appendNode('version', it.version)
63+
}
64+
}
65+
}
66+
}
67+
}
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+
}
81+
}
82+
83+
signing {
84+
def signingKeyId = findProperty("signingKeyId")
85+
def signingKey = findProperty("signingKey")
86+
def signingPassword = findProperty("signingPassword")
87+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
88+
sign publishing.publications
89+
}

nestedscrollwebview/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ android {
3030

3131
dependencies {
3232
implementation 'androidx.core:core-ktx:1.8.0'
33-
implementation 'androidx.appcompat:appcompat:1.4.2'
3433
implementation 'com.google.android.material:material:1.6.1'
3534

3635
testImplementation 'junit:junit:4.13.2'
3736
}
37+
38+
apply from: "${rootProject.projectDir}/mavencentral.gradle"

0 commit comments

Comments
 (0)