Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit 24b9942

Browse files
committed
ci: publish setup and docs
1 parent 4b640da commit 24b9942

File tree

6 files changed

+132
-38
lines changed

6 files changed

+132
-38
lines changed

.github/workflows/publish.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: "Version to publish (e.g., 1.0.0)"
10+
required: true
11+
type: string
12+
13+
env:
14+
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4g -XX:+UseParallelGC"
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
publish:
21+
runs-on: macos-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up JDK 17
27+
uses: actions/setup-java@v4
28+
with:
29+
java-version: "17"
30+
distribution: "temurin"
31+
32+
- name: Setup Gradle
33+
uses: gradle/gradle-build-action@v2
34+
35+
- name: Grant execute permission for gradlew
36+
run: chmod +x gradlew
37+
38+
- name: Set version
39+
id: set_version
40+
run: |
41+
if [ "${{ github.event_name }}" = "release" ]; then
42+
VERSION="${{ github.event.release.tag_name }}"
43+
else
44+
VERSION="${{ github.event.inputs.version }}"
45+
fi
46+
# Trim leading 'v' if present (e.g., v1.2.3 -> 1.2.3)
47+
VERSION="${VERSION#v}"
48+
echo "VERSION=$VERSION" >> $GITHUB_ENV
49+
echo "ORG_GRADLE_PROJECT_openIapVersion=$VERSION" >> $GITHUB_ENV
50+
51+
- name: Build and test
52+
run: |
53+
./gradlew :openiap:build --no-daemon --stacktrace
54+
./gradlew :openiap:test --no-daemon --stacktrace
55+
56+
- name: Publish to Maven Central
57+
env:
58+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
59+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
60+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}
61+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
62+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
63+
run: |
64+
./gradlew :openiap:publishAndReleaseToMavenCentral --no-daemon --no-parallel --stacktrace
65+
66+
- name: Create GitHub Release (workflow_dispatch)
67+
if: github.event_name == 'workflow_dispatch'
68+
uses: softprops/action-gh-release@v1
69+
with:
70+
tag_name: ${{ env.VERSION }}
71+
name: ${{ env.VERSION }}
72+
draft: false
73+
prerelease: false
74+
generate_release_notes: true
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
78+
- name: Create release artifacts (workflow_dispatch)
79+
if: github.event_name == 'workflow_dispatch'
80+
run: |
81+
mkdir -p release-artifacts
82+
cp openiap/build/outputs/aar/*.aar release-artifacts/ || true
83+
cp openiap/build/libs/*.jar release-artifacts/ || true
84+
(cd release-artifacts && sha256sum * || shasum -a 256 *) > checksums.txt || true
85+
zip -r release-artifacts.zip release-artifacts/
86+
87+
- name: Upload release artifacts (workflow_dispatch)
88+
if: github.event_name == 'workflow_dispatch'
89+
uses: softprops/action-gh-release@v1
90+
with:
91+
files: ./release-artifacts.zip
92+
name: ${{ env.VERSION }}
93+
tag_name: ${{ env.VERSION }}
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Feel free to:
114114

115115
- Open an issue for bugs or features
116116
- Start a discussion for questions
117-
- Tag @hyodotdev for urgent matters
117+
- Tag @chan for urgent matters
118118

119119
## License
120120

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ Contributions are welcome! Please read our contributing guidelines and submit pu
448448
## 📞 Support
449449

450450
- **Issues**: [GitHub Issues](https://github.com/hyodotdev/openiap-google/issues)
451-
- **Discussions**: [GitHub Discussions](https://github.com/hyodotdev/openiap.dev/discussions)
451+
- **Discussions**: [OpenIAP Discussions](https://github.com/hyodotdev/openiap.dev/discussions)
452452

453453
---
454454

build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ plugins {
22
id("com.android.library") version "8.5.0" apply false
33
id("com.android.application") version "8.5.0" apply false
44
id("org.jetbrains.kotlin.android") version "1.9.24" apply false
5+
id("com.vanniktech.maven.publish") version "0.28.0" apply false
56
}
67

8+
// Configure Sonatype (OSSRH) publishing at the root
9+
// Credentials are sourced from env or gradle.properties (OSSRH_USERNAME/OSSRH_PASSWORD)
10+
// Maven Central publishing is configured per-module via Vanniktech plugin.
11+
712
tasks.register("clean", Delete::class) {
813
delete(rootProject.layout.buildDirectory)
914
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ POM_SCM_CONNECTION=scm:git:git://github.com/hyodotdev/openiap-google.git
3030
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/hyodotdev/openiap-google.git
3131
POM_LICENCE_NAME=MIT License
3232
POM_LICENCE_URL=https://opensource.org/licenses/MIT
33-
POM_DEVELOPER_ID=hyodo-dev
34-
POM_DEVELOPER_NAME=hyodo.dev
33+
POM_DEVELOPER_ID=hyochan
34+
POM_DEVELOPER_NAME=hyo.dev
3535

3636
# Compose versions (shown on Gradle sync)
3737
COMPOSE_UI_VERSION=1.6.8

openiap/build.gradle.kts

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id("com.android.library")
33
id("org.jetbrains.kotlin.android")
4-
id("maven-publish")
4+
id("com.vanniktech.maven.publish")
55
}
66

77
// Resolve version from either 'openIapVersion' or 'OPENIAP_VERSION' or fallback
@@ -87,42 +87,36 @@ dependencies {
8787
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
8888
}
8989

90-
publishing {
91-
publications {
92-
register<MavenPublication>("release") {
93-
groupId = project.findProperty("OPENIAP_GROUP_ID")?.toString() ?: "dev.hyo.openiap"
94-
artifactId = "openiap-google"
95-
version = openIapVersion
90+
// Configure Vanniktech Maven Publish
91+
mavenPublishing {
92+
val group = project.findProperty("OPENIAP_GROUP_ID")?.toString() ?: "dev.hyo.openiap"
93+
coordinates(group, "openiap-google", openIapVersion)
9694

97-
afterEvaluate {
98-
from(components["release"])
99-
}
95+
// Use Sonatype S01 host
96+
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.S01)
97+
signAllPublications()
98+
99+
pom {
100+
name.set("OpenIAP GMS")
101+
description.set("OpenIAP Android library using Google Play Billing v8")
102+
url.set("https://github.com/hyodotdev/openiap-google")
100103

101-
pom {
102-
name.set("OpenIAP GMS")
103-
description.set("OpenIAP Android library using Google Play Billing v8")
104-
url.set("https://github.com/hyodotdev/openiap-google")
105-
106-
licenses {
107-
license {
108-
name.set("MIT License")
109-
url.set("https://opensource.org/licenses/MIT")
110-
}
111-
}
112-
113-
developers {
114-
developer {
115-
id.set("hyodo-dev")
116-
name.set("hyodo.dev")
117-
}
118-
}
119-
120-
scm {
121-
connection.set("scm:git:git://github.com/hyodotdev/openiap-google.git")
122-
developerConnection.set("scm:git:ssh://git@github.com/hyodotdev/openiap-google.git")
123-
url.set("https://github.com/hyodotdev/openiap-google")
124-
}
104+
licenses {
105+
license {
106+
name.set("MIT License")
107+
url.set("https://opensource.org/licenses/MIT")
125108
}
126109
}
110+
developers {
111+
developer {
112+
id.set("hyochan")
113+
name.set("hyochan")
114+
}
115+
}
116+
scm {
117+
connection.set("scm:git:git://github.com/hyodotdev/openiap-google.git")
118+
developerConnection.set("scm:git:ssh://git@github.com/hyodotdev/openiap-google.git")
119+
url.set("https://github.com/hyodotdev/openiap-google")
120+
}
127121
}
128122
}

0 commit comments

Comments
 (0)