Skip to content

Commit a0e8f0f

Browse files
committed
feat: WIP try to add publishing
1 parent 5158503 commit a0e8f0f

File tree

3 files changed

+83
-2
lines changed

3 files changed

+83
-2
lines changed

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
workflow_dispatch:
7+
inputs:
8+
release:
9+
description: 'Publish release to Maven Central'
10+
type: boolean
11+
required: true
12+
default: false
13+
release:
14+
types: [ published ]
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Set up JDK 11
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: 'temurin'
30+
java-version: '11'
31+
32+
- name: Setup Gradle
33+
uses: gradle/gradle-build-action@v3
34+
35+
- name: Build
36+
run: ./gradlew build
37+
38+
- name: Snapshot deploy
39+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
40+
run: ./gradlew publishToMavenCentral
41+
env:
42+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
43+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
44+
45+
- name: Release deploy
46+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.release)
47+
run: ./gradlew publishToMavenCentral -PRELEASE
48+
env:
49+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
50+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
51+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MOE_RELEASE_PRIVATE_KEY }}
52+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MOE_RELEASE_PRIVATE_KEY_PASSPHRASE }}

build.gradle.kts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
plugins {
22
id("java-library")
3+
id("com.vanniktech.maven.publish") version "0.34.0"
34
}
45

5-
group = "io.github.berstanio"
6-
version = "1.0-SNAPSHOT"
6+
fun isReleaseBuild() = hasProperty("RELEASE")
7+
8+
group = property("GROUP") as String
9+
version = property("VERSION") as String + (if (isReleaseBuild()) "" else "-SNAPSHOT")
710

811
repositories {
912
mavenCentral()
@@ -23,4 +26,10 @@ dependencies {
2326

2427
tasks.test {
2528
useJUnitPlatform()
29+
}
30+
31+
mavenPublishing {
32+
publishToMavenCentral()
33+
if (isReleaseBuild())
34+
signAllPublications()
2635
}

gradle.properties

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
GROUP=org.multi-os-engine
2+
POM_ARTIFACT_ID=javapymobiledevice3
3+
VERSION=1.0.0
4+
5+
POM_NAME=JavaPyMobiledevice3
6+
POM_DESCRIPTION=An IPC bridge between java and pymobiledevice3
7+
POM_INCEPTION_YEAR=2025
8+
POM_URL=https://github.com/multi-os-engine/JavaPyMobiledevice3/
9+
10+
POM_LICENSE_NAME=The Apache Software License, Version 2.0
11+
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
12+
POM_LICENSE_DIST=repo
13+
14+
POM_SCM_URL=https://github.com/multi-os-engine/JavaPyMobiledevice3/
15+
POM_SCM_CONNECTION=scm:git:git://github.com/multi-os-engine/JavaPyMobiledevice3.git
16+
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/multi-os-engine/JavaPyMobiledevice3.git
17+
18+
POM_DEVELOPER_ID=MOE
19+
POM_DEVELOPER_NAME=Multi-OS Engine Dev
20+
POM_DEVELOPER_URL=https://www.multi-os-engine.org/

0 commit comments

Comments
 (0)