Skip to content

Commit 774d570

Browse files
Publish snapshot on maven for testing the java-libkiwix
1 parent 42b50ca commit 774d570

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish Snapshot to Maven
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags-ignore:
8+
- '*'
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-20.04
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 1
18+
19+
- name: Set up JDK 11
20+
uses: actions/setup-java@v2
21+
with:
22+
distribution: adopt
23+
java-version: 11
24+
25+
- name: Install dependencies
26+
run: bash ./install_deps.sh
27+
28+
- name: Compile Project
29+
run: |
30+
./gradlew buildHeaders build
31+
32+
- name: Generate Source jar
33+
run: |
34+
./gradlew androidSourcesJar
35+
36+
- name: Publish Snapshot to MavenCentral
37+
run: ./gradlew publishToSonatype --info
38+
env:
39+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
40+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
41+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
42+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
43+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
44+

lib/publish.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ afterEvaluate {
6363
}
6464
repositories {
6565
maven {
66-
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
66+
if (VERSION.endsWith('-SNAPSHOT')) {
67+
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
68+
} else {
69+
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
70+
}
6771
credentials {
6872
username = ossrhUsername
6973
password = ossrhPassword

0 commit comments

Comments
 (0)