-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wpeview] Add configs to publish to maven repository
- Loading branch information
Showing
2 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Publish to Maven Central | ||
|
||
on: | ||
workflow_dispatch: # Allow manual trigger | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Fetch Dependencies (WPE Bootstrap) | ||
run: python3 tools/scripts/bootstrap.py -a all | ||
- name: Java™ Setup | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
- name: Build and publish | ||
run: ./gradlew wpeview:publishReleasePublicationToOSSRHRepository | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.PGP_CENTRAL_SIGNING_KEY }} | ||
SIGNING_PASSWORD: ${{ secrets.PGP_CENTRAL_SIGNING_KEY_PASSPHRASE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'maven-publish' | ||
id 'signing' | ||
} | ||
|
||
android { | ||
|
@@ -88,6 +90,14 @@ android { | |
}) | ||
} | ||
} | ||
|
||
publishing { | ||
singleVariant('release') { | ||
// This ensures only the release variant is published | ||
withSourcesJar() // Include sources JAR | ||
withJavadocJar() // Include Javadoc JAR (optional) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
@@ -97,6 +107,78 @@ dependencies { | |
androidTestImplementation "androidx.test.ext:junit:1.2.1" | ||
} | ||
|
||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
afterEvaluate { | ||
from components.release | ||
} | ||
|
||
groupId 'org.wpewebkit.wpeview' | ||
artifactId 'wpeview' | ||
version '0.1.0' | ||
|
||
// The sources and Javadoc JARs are automatically added because of `withSourcesJar()` and `withJavadocJar()` above | ||
|
||
pom { | ||
name = 'WPEView' | ||
description = 'WPE WebKit for Android' | ||
url = 'https://github.com/Igalia/wpe-android' | ||
|
||
licenses { | ||
license { | ||
name = 'GNU Lesser General Public License v2.1' | ||
url = 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt' | ||
distribution = 'repo' | ||
} | ||
} | ||
|
||
scm { | ||
connection = 'scm:[email protected]/Igalia/wpe-android.git' | ||
url = 'https://github.com/Igalia/wpe-android.git' | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "OSSRH" | ||
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
|
||
credentials { | ||
username = project.findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME") | ||
password = project.findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD") | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
def signingKey = project.findProperty("signing.secretKey") ?: System.getenv("SIGNING_KEY") | ||
def signingPassword = project.findProperty("signing.password")?: System.getenv("SIGNING_PASSWORD") | ||
|
||
if (signingKey && signingPassword) { | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign publishing.publications | ||
} else { | ||
logger.warn("Signing key or password not found, signing will be skipped.") | ||
} | ||
} | ||
|
||
tasks.withType(Javadoc).configureEach { | ||
enabled = false // Disable Javadoc if not needed | ||
} | ||
|
||
tasks.register('javadocJar', Jar) { | ||
archiveClassifier.set('javadoc') | ||
} | ||
|
||
tasks.register('sourcesJar', Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
archiveClassifier.set('sources') | ||
} | ||
|
||
gradle.afterProject { project -> | ||
if (project == getProject()) { | ||
def abiList = [] | ||
|