Skip to content

Commit 12fca6a

Browse files
migrate from app nexus to maven central release
1 parent 3537eae commit 12fca6a

File tree

2 files changed

+110
-87
lines changed

2 files changed

+110
-87
lines changed

.github/workflows/release-sdk.yml

Lines changed: 69 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,17 @@ jobs:
4949
else
5050
echo "content=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT
5151
fi
52-
- name: Prepare environment
53-
env:
54-
SIGNING_SECRET_KEY_RING_FILE_CONTENT: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE_CONTENT }}
55-
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
56-
run: sudo bash -c "echo '$SIGNING_SECRET_KEY_RING_FILE_CONTENT' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
5752
- name: Release build
5853
run: ./gradlew cmplibrary:assemble
5954
- name: Source jar and dokka
6055
run: ./gradlew androidSourcesJar javadocJar
61-
- name: Publish to MavenCentral
62-
run: ./gradlew publishReleasePublicationToSonatypeRepository #--max-workers 1 closeAndReleaseRepository --info
56+
- run: ./gradlew publish --no-parallel --no-configuration-cache
6357
env:
64-
OSSRH_TOKEN_USER: ${{ secrets.OSSRH_TOKEN_USER }}
65-
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
66-
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
67-
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
68-
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
58+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }}
59+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }}
60+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }}
61+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }}
62+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }}
6963
- name: Add, commit and push edited files
7064
env:
7165
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
@@ -84,66 +78,66 @@ jobs:
8478
${{ steps.release_note.outputs.content }}
8579
draft: false
8680
prerelease: false
87-
release-metaapp:
88-
runs-on: ubuntu-latest
89-
permissions:
90-
contents: write
91-
steps:
92-
- uses: actions/checkout@v4
93-
- name: set up JDK 17
94-
uses: actions/setup-java@v4
95-
with:
96-
distribution: zulu
97-
java-version: 17
98-
cache: gradle
99-
- name: Bump versionCode
100-
id: bump
101-
run: |
102-
git config user.email "andre@sourcepoint.com"
103-
git config user.name "GitHub Action"
104-
./gradlew metaapp:bumpVersionCode
105-
- name: creating local.properties
106-
run: touch local.properties
107-
- name: generating MetaApp build release
108-
id: buildRelease
109-
run: ./gradlew :metaapp:bundleRelease :metaapp:bundleDebug :metaapp:assembleRelease :metaapp:assembleDebug
110-
- name: Sign APK
111-
id: sign
112-
# uses v1 tag of r0adkll/sign-android-release as of 2025-04-15
113-
uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407
114-
with:
115-
releaseDirectory: samples/metaapp/build/outputs/bundle/release
116-
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
117-
alias: ${{ secrets.SIGNING_ALIAS }}
118-
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
119-
keyPassword: ${{ secrets.KEY_ALIAS_PASSWORD }}
120-
- name: Create service_account.json
121-
id: createServiceAccount
122-
run: |
123-
echo '${{ secrets.SERVICE_ACCOUNT_JSON }}' > service_account.json
124-
- name: 'Publish release artifact'
125-
if: always()
126-
uses: actions/upload-artifact@v4
127-
with:
128-
name: 'release-artifact'
129-
path: ${{ steps.sign.outputs.signedReleaseFile }}
130-
- name: Deploy to Play Store
131-
id: deploy
132-
# uses v1.0.15 tag of r0adkll/upload-google-play as of 2025-04-15
133-
uses: r0adkll/upload-google-play@9745ef904e395471bca5696056a6ce8a60d18cf8
134-
with:
135-
serviceAccountJson: service_account.json
136-
packageName: com.sourcepointmeta.metaapp
137-
releaseFiles: ${{ steps.sign.outputs.signedReleaseFile }}
138-
track: production
139-
- name: Add, commit and push edited files
140-
env:
141-
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
142-
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
143-
run: ./gradlew addCommitPush
144-
- name: Publish MetaAppDebug artifact
145-
if: always()
146-
uses: actions/upload-artifact@v4
147-
with:
148-
name: MetaAppDebug
149-
path: samples/metaapp/build/outputs/apk/debug/metaapp-debug.apk
81+
# release-metaapp:
82+
# runs-on: ubuntu-latest
83+
# permissions:
84+
# contents: write
85+
# steps:
86+
# - uses: actions/checkout@v4
87+
# - name: set up JDK 17
88+
# uses: actions/setup-java@v4
89+
# with:
90+
# distribution: zulu
91+
# java-version: 17
92+
# cache: gradle
93+
# - name: Bump versionCode
94+
# id: bump
95+
# run: |
96+
# git config user.email "andre@sourcepoint.com"
97+
# git config user.name "GitHub Action"
98+
# ./gradlew metaapp:bumpVersionCode
99+
# - name: creating local.properties
100+
# run: touch local.properties
101+
# - name: generating MetaApp build release
102+
# id: buildRelease
103+
# run: ./gradlew :metaapp:bundleRelease :metaapp:bundleDebug :metaapp:assembleRelease :metaapp:assembleDebug
104+
# - name: Sign APK
105+
# id: sign
106+
# # uses v1 tag of r0adkll/sign-android-release as of 2025-04-15
107+
# uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407
108+
# with:
109+
# releaseDirectory: samples/metaapp/build/outputs/bundle/release
110+
# signingKeyBase64: ${{ secrets.SIGNING_KEY }}
111+
# alias: ${{ secrets.SIGNING_ALIAS }}
112+
# keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
113+
# keyPassword: ${{ secrets.KEY_ALIAS_PASSWORD }}
114+
# - name: Create service_account.json
115+
# id: createServiceAccount
116+
# run: |
117+
# echo '${{ secrets.SERVICE_ACCOUNT_JSON }}' > service_account.json
118+
# - name: 'Publish release artifact'
119+
# if: always()
120+
# uses: actions/upload-artifact@v4
121+
# with:
122+
# name: 'release-artifact'
123+
# path: ${{ steps.sign.outputs.signedReleaseFile }}
124+
# - name: Deploy to Play Store
125+
# id: deploy
126+
# # uses v1.0.15 tag of r0adkll/upload-google-play as of 2025-04-15
127+
# uses: r0adkll/upload-google-play@9745ef904e395471bca5696056a6ce8a60d18cf8
128+
# with:
129+
# serviceAccountJson: service_account.json
130+
# packageName: com.sourcepointmeta.metaapp
131+
# releaseFiles: ${{ steps.sign.outputs.signedReleaseFile }}
132+
# track: production
133+
# - name: Add, commit and push edited files
134+
# env:
135+
# GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
136+
# GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
137+
# run: ./gradlew addCommitPush
138+
# - name: Publish MetaAppDebug artifact
139+
# if: always()
140+
# uses: actions/upload-artifact@v4
141+
# with:
142+
# name: MetaAppDebug
143+
# path: samples/metaapp/build/outputs/apk/debug/metaapp-debug.apk

cmplibrary/build.gradle.kts

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1+
import com.vanniktech.maven.publish.SonatypeHost
2+
3+
var versionLib = project.property("VERSION_NAME") as String
4+
5+
group = "com.sourcepoint.cmplibrary"
6+
version = versionLib
7+
18
plugins {
29
id("com.android.library")
310
kotlin("android")
411
id("io.github.dryrum.update-changelog")
512
id("io.github.dryrum.replace-in-file")
613
id("io.github.dryrum.git-utils")
714
id("kotlinx-serialization")
15+
id("com.vanniktech.maven.publish") version "0.32.0"
816
}
917

10-
val versionLib = project.property("VERSION_NAME") as String
11-
12-
group = "com.sourcepoint.cmplibrary"
13-
version = versionLib
14-
1518
android {
1619
compileSdk = 35
1720
namespace = "com.sourcepoint.cmplibrary"
@@ -67,8 +70,7 @@ dependencies {
6770
tasks.register("versionTxt") {
6871
group = "release-utility"
6972
doLast {
70-
val version = project.property("VERSION_NAME") as String
71-
File(projectDir, "version.txt").writeText(version)
73+
File(projectDir, "version.txt").writeText(versionLib)
7274
}
7375
}
7476

@@ -80,22 +82,49 @@ addCommitPushConfig {
8082
}
8183

8284
replaceInFile {
83-
val versionName = project.property("VERSION_NAME") as String
8485
docs {
8586
create("doc") {
8687
path = "${rootDir.path}/README.md"
8788
find = "com.sourcepoint.cmplibrary:cmplibrary:(\\d)+\\.(\\d)+\\.(\\d)+"
88-
replaceWith = "com.sourcepoint.cmplibrary:cmplibrary:$versionName"
89+
replaceWith = "com.sourcepoint.cmplibrary:cmplibrary:$versionLib"
8990
}
9091
}
9192
}
9293

9394
changeLogConfig {
94-
val versionName = project.property("VERSION_NAME") as String
9595
changeLogPath = rootDir.path + "/CHANGELOG.md"
9696
content = file( "${rootDir.path}/${project.name}/release_note.txt").readText()
97-
version = versionName
97+
this.version = versionLib
9898
}
9999

100100
apply(from = "${project.rootDir.path}/gradleutils/ktlint_utils.gradle")
101-
apply(from = "${project.rootDir.path}/scripts/publish-mavencentral.gradle")
101+
102+
mavenPublishing {
103+
coordinates(group.toString(), "cmplibrary", versionLib)
104+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
105+
signAllPublications()
106+
pom {
107+
name = "Sourcepoint Android CMP"
108+
description = "The internal Network & Data layers used by our mobile SDKs"
109+
url = "https://github.com/SourcePointUSA/android-cmp-app"
110+
111+
licenses {
112+
license {
113+
name = "The Apache License, Version 2.0"
114+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
115+
}
116+
}
117+
developers {
118+
developer {
119+
id = "andresilveirah"
120+
name = "Andre Herculano"
121+
email = "andresilveirah@gmail.com"
122+
}
123+
}
124+
scm {
125+
connection = "scm:git:github.com/SourcePointUSA/android-cmp-app.git"
126+
developerConnection = "scm:git:ssh://github.com/SourcePointUSA/android-cmp-app.git"
127+
url = "https://github.com/SourcePointUSA/android-cmp-app/tree/main"
128+
}
129+
}
130+
}

0 commit comments

Comments
 (0)