Skip to content

Commit

Permalink
Merge pull request #2 from Telefonica/publishing
Browse files Browse the repository at this point in the history
ANDROID-10730 Publishing
  • Loading branch information
dpastor authored Aug 9, 2022
2 parents 78e6439 + dd5a1b1 commit dacbabf
Show file tree
Hide file tree
Showing 10 changed files with 303 additions and 4 deletions.
17 changes: 17 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- tuentisre
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: New Features 🎉
labels:
- enhancement
- new-feature
- title: Other Changes
labels:
- "*"
25 changes: 25 additions & 0 deletions .github/workflows/manual_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Release manually"
on:
workflow_dispatch:
inputs:
libraryVersion:
description: "Library version"
required: true
jobs:
manual-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Build library
run: 'bash ./gradlew clean :nestedscrollwebview:assembleRelease'

- name: Release library manually
env:
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
run: "bash ./gradlew publishReleasePublicationToSonatypeRepository -DLIBRARY_VERSION=${{ github.event.inputs.libraryVersion }}"
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Create release"
on:
release:
types: [published]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Build library
run: 'bash ./gradlew clean :nestedscrollwebview:assembleRelease'

- name: Release library
env:
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
run: "bash ./gradlew publishReleasePublicationToSonatypeRepository -DLIBRARY_VERSION=${{ github.event.release.tag_name }}"

- name: Wait 1 minute until the artifacts are ready in maven central
run: sleep 60s
shell: bash

- name: Close and promote staging repository
env:
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
run: 'bash ./gradlew closeAndReleaseRepository'
25 changes: 25 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Snapshot"
on:
workflow_dispatch:
inputs:
snapshotVersion:
description: "Snapshot version"
required: true
jobs:
snapshot:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Build library
run: 'bash ./gradlew clean :nestedscrollwebview:assembleRelease'

- name: Release snapshot
env:
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
run: "bash ./gradlew publishReleasePublicationToSonatypeRepository -DSNAPSHOT_VERSION=${{ github.event.inputs.snapshotVersion }}"
25 changes: 25 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests
on: pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.5

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'

## Build all our Build Types at once ##
- name: Build all artifacts
id: buildAllApks
uses: eskatos/gradle-command-action@v1.3.3
with:
gradle-version: current
wrapper-cache-enabled: false
dependencies-cache-enabled: false
configuration-cache-enabled: false
arguments: assembleRelease check detekt
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
# android-nested-scroll-webview
<p>
<img src="https://img.shields.io/badge/Platform-Android-brightgreen" />
<img src="https://maven-badges.herokuapp.com/maven-central/com.telefonica/nestedscrollwebview/badge.png" />
<img src="https://img.shields.io/badge/Support-%3E%3D%20Android%205.0-brightgreen" />
</p>

# Android Nested Scroll WebView

Android WebView implementation for nested scrolling layouts

To include the library add to your app's `build.gradle`:

```gradle
implementation 'com.telefonica:nestedscrollwebview:{version}'
```
43 changes: 41 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,49 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
}
}

plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'io.gitlab.arturbosch.detekt' version '1.18.1'
}

detekt {
input = files(rootProject.rootDir)
config = files("$projectDir/detekt.yml")
failFast = true
buildUponDefaultConfig = true

reports {
html.enabled = true
xml.enabled = true
xml.destination = file("$buildDir/reports/detekt/detekt-checkstyle.xml")
html.destination = file("$buildDir/reports/detekt/detekt-report.html")
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

apply plugin: 'io.codearte.nexus-staging'

nexusStaging {
packageGroup = "com.telefonica"
stagingProfileId = "f7fe7699e57a"
username = System.getenv("MOBILE_MAVENCENTRAL_USER")
password = System.getenv("MOBILE_MAVENCENTRAL_PASSWORD")
}

allprojects {
group = 'com.telefonica.nestedscrollwebview'
if (System.getProperty("SNAPSHOT_VERSION") != null) {
version = System.getProperty("SNAPSHOT_VERSION")+"-SNAPSHOT"
} else {
version = System.getProperty("LIBRARY_VERSION") ?: "undefined"
}
}
32 changes: 32 additions & 0 deletions detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
build:
maxIssues: 0
weights:
complexity: 2
formatting: 1
LongParameterList: 1
comments: 1

complexity:
TooManyFunctions:
active: false
LongMethod:
active: false
LongParameterList:
active: false

empty-blocks:
EmptyFunctionBlock:
active: false
style:
MagicNumber:
active: false
NewLineAtEndOfFile:
active: false
UnusedPrivateMember:
active: false
WildcardImport:
active: false

exceptions:
TooGenericExceptionThrown:
active: false
89 changes: 89 additions & 0 deletions mavencentral.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

artifacts {
archives sourcesJar
}

apply plugin: 'maven-publish'
apply plugin: 'signing'

ext {
PUBLISH_GROUP_ID = 'com.telefonica'
PUBLISH_ARTIFACT_ID = 'nestedscrollwebview'
PUBLISH_VERSION = version

PUBLISH_RELEASE_NAME = 'Nested Scroll WebView for Android'
PUBLISH_DESCRIPTION = 'A webView implementation with nested scrolling support'
PUBLISH_REPO_URL = 'https://github.com/Telefonica/android-nested-scroll-webview'
}

publishing {
publications {
release(MavenPublication) {
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION

artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact sourcesJar

pom {
name = PUBLISH_RELEASE_NAME
description = PUBLISH_DESCRIPTION
url = PUBLISH_REPO_URL
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'android-team-telefonica'
name = 'Android Team'
email = 'cto-android@telefonica.com'
}
}
scm {
connection = 'scm:git:https://github.com/Telefonica/android-nested-scroll-webview.git'
developerConnection = 'scm:git:ssh://https://github.com/Telefonica/android-nested-scroll-webview.git'
url = 'https://github.com/Telefonica/android-nested-scroll-webview/tree/main'
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')

project.configurations.getByName("implementation").allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
repositories {
maven {
name = "sonatype"

def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username System.getenv("MOBILE_MAVENCENTRAL_USER")
password System.getenv("MOBILE_MAVENCENTRAL_PASSWORD")
}
}
}
}

signing {
def signingKeyId = findProperty("signingKeyId")
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign publishing.publications
}
3 changes: 2 additions & 1 deletion nestedscrollwebview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ android {

dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'

testImplementation 'junit:junit:4.13.2'
}

apply from: "${rootProject.projectDir}/mavencentral.gradle"

0 comments on commit dacbabf

Please sign in to comment.