Skip to content

Commit 26f5661

Browse files
alexey-pelykhclaude
andcommitted
(chore) migrate deployment to JReleaser
Replace direct OSSRH publishing with JReleaser-based deployment via Sonatype Central Portal API. Gradle now only stages artifacts to a local directory; JReleaser handles GPG signing and Maven Central upload. - Add JReleaser 1.22.0 plugin to version catalog and root build - Create jreleaser.yml with signing, Maven Central release, and snapshot deploy configuration - Replace OSSRH/GitHubPackages repos with local StagingDeploy in lib - Remove Gradle signing plugin (JReleaser handles signing) - Restore build-lib CI job with JReleaser snapshot publishing - Update release workflow to use two-step stage + JReleaser deploy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d3f5241 commit 26f5661

6 files changed

Lines changed: 85 additions & 133 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 26 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
name: CI
22

33
on:
4+
45
push:
56
branches:
67
- main
8+
79
pull_request:
810
branches:
911
- main
1012

1113
jobs:
1214

13-
package:
15+
build-lib:
1416
runs-on: ubuntu-24.04
1517

16-
permissions:
17-
contents: read
18-
packages: write
19-
2018
steps:
2119
- name: Checkout
2220
uses: actions/checkout@v4
@@ -30,99 +28,43 @@ jobs:
3028
- name: Setup Gradle
3129
uses: gradle/actions/setup-gradle@v3
3230

33-
- name: Set up Git Hub Pages
34-
uses: actions/configure-pages@v5
35-
3631
- name: Setup Android SDK
3732
uses: android-actions/setup-android@v3
3833
with:
3934
packages: ndk-bundle
4035

41-
- name: Setup Flutter SDK
42-
uses: flutter-actions/setup-flutter@v3
43-
with:
44-
version: 3.29.2
45-
46-
- name: Cache Gradle packages
47-
uses: actions/cache@v4
48-
with:
49-
path: |
50-
~/.gradle/caches
51-
~/.gradle/wrapper
52-
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
53-
restore-keys: gradle-${{ runner.os }}
54-
55-
- name: Get pub cache location
56-
id: get-pub-cache
57-
shell: bash
58-
run: |
59-
echo "pub_cache=$PUB_CACHE" >> "$GITHUB_OUTPUT"
60-
61-
- name: Cache Pub
62-
uses: actions/cache@v3
63-
with:
64-
path: ${{ steps.get-pub-cache.outputs.pub_cache }}
65-
key: pub-${{ runner.os }}-${{ hashFiles('**/pubspec.lock') }}
66-
67-
- name: Inflate Keystore
68-
env:
69-
ANDROID_JKS: ${{ secrets.ANDROID_JKS }}
70-
ANDROID_JKS_SHA256: ${{ secrets.ANDROID_JKS_SHA256 }}
71-
run: |
72-
JKS_FILE="$(mktemp -p "${RUNNER_TEMP}" -d)/android.jks"
73-
echo -n "$ANDROID_JKS" | base64 --decode > "$JKS_FILE"
74-
75-
if [ "${ANDROID_JKS_SHA256} *-" != "$(cat $JKS_FILE | sha256sum -b)" ]; then
76-
exit 1
77-
fi
78-
79-
echo "ANDROID_JKS_FILE=$JKS_FILE" >> $GITHUB_ENV
80-
81-
- name: Flutter plugin dependencies
82-
working-directory: flutter
83-
run: |
84-
flutter pub get \
85-
|| exit $?
86-
87-
- name: Analyze Flutter plugin
88-
working-directory: flutter
89-
run: |
90-
flutter analyze \
91-
--no-pub \
92-
|| exit $?
93-
94-
- name: Lint Flutter plugin
95-
working-directory: flutter
96-
run: |
97-
dart format \
98-
--set-exit-if-changed \
99-
. \
100-
|| exit $?
101-
10236
- name: Build
103-
env:
104-
ANDROID_JKS_PASSWORD: ${{ secrets.ANDROID_JKS_PASSWORD }}
105-
run: ./gradlew assembleRelease publishToMavenLocal
37+
run: ./gradlew :lib:assembleRelease
10638

107-
- name: Upload lib artifacts
39+
- name: Upload artifacts
10840
uses: actions/upload-artifact@v4
10941
with:
11042
name: lib
11143
path: lib/build/outputs/aar/*-release.aar
11244

113-
- name: Build Flutter example
114-
working-directory: flutter/example
45+
- name: Stage snapshot artifacts
46+
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
47+
run: ./gradlew :lib:publishReleasePublicationToStagingDeployRepository -Puvccamera.version=main-SNAPSHOT
48+
49+
- name: Publish snapshot artifacts
50+
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
11551
env:
116-
ANDROID_JKS_PASSWORD: ${{ secrets.ANDROID_JKS_PASSWORD }}
117-
run: flutter build apk
52+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
JRELEASER_NEXUS2_SNAPSHOTS_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
54+
JRELEASER_NEXUS2_SNAPSHOTS_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
55+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
56+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
57+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
58+
run: ./gradlew jreleaserDeploy --no-configuration-cache -Puvccamera.version=main-SNAPSHOT
59+
60+
build-github-pages:
61+
runs-on: ubuntu-24.04
11862

119-
- name: Upload Flutter example artifacts
120-
uses: actions/upload-artifact@v4
121-
with:
122-
name: flutter-example
123-
path: flutter/example/build/app/outputs/flutter-apk/*-release.apk
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
12466

125-
- name: Build docs
67+
- name: Build
12668
run: |
12769
sudo apt-get install -y pandoc
12870
@@ -141,29 +83,17 @@ jobs:
14183
with:
14284
path: build/gh-pages
14385

144-
- name: Publish artifacts
145-
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
146-
env:
147-
ANDROID_JKS_PASSWORD: ${{ secrets.ANDROID_JKS_PASSWORD }}
148-
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
149-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
150-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
152-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
153-
run: ./gradlew publish -Puvccamera.version=${{ github.ref_name }}-SNAPSHOT
154-
15586
publish-github-pages:
15687
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
15788

15889
runs-on: ubuntu-24.04
15990

16091
permissions:
161-
contents: read
16292
pages: write
16393
id-token: write
16494

16595
needs:
166-
- package
96+
- build-github-pages
16797

16898
environment:
16999
name: github-pages

.github/workflows/release.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,18 @@ jobs:
105105
name: flutter-example
106106
path: flutter/example/build/app/outputs/flutter-apk/*-release.apk
107107

108+
- name: Stage library artifacts
109+
run: ./gradlew :lib:publishReleasePublicationToStagingDeployRepository -Puvccamera.version=${{ github.ref_name }}
110+
108111
- name: Publish library artifacts
109112
env:
110-
ANDROID_JKS_PASSWORD: ${{ secrets.ANDROID_JKS_PASSWORD }}
111-
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
112-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
113-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
115-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
116-
run: ./gradlew :lib:publish -Puvccamera.version=${{ github.ref_name }}
113+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
115+
JRELEASER_MAVENCENTRAL_SONATYPE_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
116+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
117+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
118+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
119+
run: ./gradlew jreleaserDeploy --no-configuration-cache -Puvccamera.version=${{ github.ref_name }}
117120

118121
- name: Publish Flutter plugin
119122
working-directory: flutter

build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3+
base
34
alias(libs.plugins.android.library) apply false
45
alias(libs.plugins.android.application) apply false
6+
alias(libs.plugins.jreleaser)
7+
}
8+
9+
jreleaser {
10+
configFile = file("jreleaser.yml")
511
}

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[versions]
22
agp = "8.9.1"
3+
jreleaser = "1.22.0"
34
junit = "4.13.2"
45
supportTestRunner = "1.0.2"
56
supportEspressoCore = "3.0.2"
@@ -32,3 +33,4 @@ swiperefreshlayout = { group = "androidx.swiperefreshlayout", name = "swiperefre
3233
[plugins]
3334
android-library = { id = "com.android.library", version.ref = "agp" }
3435
android-application = { id = "com.android.application", version.ref = "agp" }
36+
jreleaser = { id = "org.jreleaser", version.ref = "jreleaser" }

jreleaser.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
project:
2+
name: UVCCamera
3+
description: USB Video (UVC) Camera Library for Android
4+
authors:
5+
- saki
6+
- Alexey Pelykh
7+
license: Apache-2.0
8+
links:
9+
homepage: https://uvccamera.org
10+
languages:
11+
java:
12+
groupId: org.uvccamera
13+
version: 17
14+
versionPattern: CUSTOM
15+
16+
release:
17+
github:
18+
skipRelease: true
19+
20+
signing:
21+
active: ALWAYS
22+
pgp:
23+
armored: true
24+
25+
deploy:
26+
maven:
27+
mavenCentral:
28+
sonatype:
29+
active: RELEASE
30+
url: https://central.sonatype.com/api/v1/publisher
31+
stagingRepositories:
32+
- lib/build/staging-deploy
33+
nexus2:
34+
snapshots:
35+
active: SNAPSHOT
36+
url: https://central.sonatype.com/repository/maven-snapshots/
37+
snapshotUrl: https://central.sonatype.com/repository/maven-snapshots/
38+
stagingRepositories:
39+
- lib/build/staging-deploy

lib/build.gradle.kts

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
alias(libs.plugins.android.library)
33
id("maven-publish")
4-
id("signing")
54
}
65

76
version = findProperty("uvccamera.version") as String? ?: "0.0.0-SNAPSHOT"
@@ -98,35 +97,8 @@ publishing {
9897

9998
repositories {
10099
maven {
101-
name = "GitHubPackages"
102-
url = uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY"))
103-
credentials {
104-
username = System.getenv("GITHUB_ACTOR")
105-
password = System.getenv("GITHUB_TOKEN")
106-
}
107-
}
108-
109-
maven {
110-
name = "OSSRH"
111-
url = uri(
112-
if (project.version.toString().endsWith("-SNAPSHOT"))
113-
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
114-
else
115-
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
116-
)
117-
credentials {
118-
username = System.getenv("OSSRH_USERNAME")
119-
password = System.getenv("OSSRH_TOKEN")
120-
}
100+
name = "StagingDeploy"
101+
url = uri(layout.buildDirectory.dir("staging-deploy"))
121102
}
122103
}
123104
}
124-
125-
val gpgPassphrase: String? = System.getenv("GPG_PASSPHRASE")
126-
val gpgPrivateKey: String? = System.getenv("GPG_PRIVATE_KEY")
127-
if (gpgPassphrase != null && gpgPrivateKey != null) {
128-
signing {
129-
useInMemoryPgpKeys(gpgPrivateKey, gpgPassphrase)
130-
sign(publishing.publications["release"])
131-
}
132-
}

0 commit comments

Comments
 (0)