Skip to content

Commit 594552e

Browse files
authored
feat: Jitpack distribution (#31)
* Add Jitpack config and allow beta releases * Add ProGuard consumer rules for internal dependencies Keep kotlinx.serialization, BouncyCastle, and OkHttp classes that are used internally by the library. These rules ensure R8/ProGuard doesn't strip classes needed at runtime when consumers minify their apps. * Update README and release notes with Jitpack info
1 parent 5c7e679 commit 594552e

File tree

4 files changed

+105
-18
lines changed

4 files changed

+105
-18
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: 'Version for the release (e.g. 1.0.0)'
7+
description: 'Version for the release (e.g. 1.0.0 or 1.0.0-beta.1)'
88
required: true
99
type: string
1010

1111
jobs:
1212
build-and-release:
1313
runs-on: ubuntu-latest
14-
14+
1515
steps:
1616
- name: Checkout repository
1717
uses: actions/checkout@v4
18-
18+
1919
- name: Validate version format
2020
run: |
21-
# Simple validation for version format
22-
if [[ ! "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
23-
echo "::error::Version must be in format X.Y.Z (e.g., 1.0.0)"
21+
# Validate version format: X.Y.Z or X.Y.Z-prerelease.N
22+
if [[ ! "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[0-9]+)?)?$ ]]; then
23+
echo "::error::Version must be in format X.Y.Z or X.Y.Z-suffix.N (e.g., 1.0.0 or 1.0.0-beta.1)"
2424
exit 1
2525
fi
2626
@@ -29,6 +29,14 @@ jobs:
2929
git config user.name "GitHub Actions"
3030
git config user.email "actions@github.com"
3131
32+
- name: Get previous tag
33+
id: prev_tag
34+
run: |
35+
git fetch --tags
36+
PREV_TAG=$(git tag --sort=-version:refname | grep -v "^${{ github.event.inputs.version }}$" | head -n1)
37+
echo "Previous tag: $PREV_TAG"
38+
echo "tag=$PREV_TAG" >> $GITHUB_OUTPUT
39+
3240
- name: Create tag
3341
run: |
3442
git tag ${{ github.event.inputs.version }}
@@ -85,28 +93,53 @@ jobs:
8593
body: |
8694
# C2PA Android Release ${{ github.event.inputs.version }}
8795
88-
## Android Integration
96+
## Installation
97+
98+
The library is available from **JitPack** and **GitHub Packages**.
99+
100+
### JitPack (Recommended)
101+
102+
```gradle
103+
// In settings.gradle
104+
dependencyResolutionManagement {
105+
repositories {
106+
maven { url 'https://jitpack.io' }
107+
}
108+
}
89109
90-
### Gradle dependency
110+
// In build.gradle
111+
dependencies {
112+
implementation 'com.github.contentauth:c2pa-android:${{ github.event.inputs.version }}'
113+
}
114+
```
115+
116+
### GitHub Packages
117+
118+
Requires authentication with a GitHub token:
119+
120+
```gradle
121+
// In build.gradle
122+
dependencies {
123+
implementation 'org.contentauth:c2pa:${{ github.event.inputs.version }}'
124+
}
125+
```
91126
92-
Add the AAR library to your Android project:
127+
### Manual AAR
93128
94-
1. Download the AAR file from this release
95-
2. Place it in your app's `libs` directory
96-
3. Add to your `build.gradle`:
129+
Download the AAR from this release and add to your project:
97130
98131
```gradle
99132
dependencies {
100133
implementation files('libs/c2pa-release.aar')
101134
}
102135
```
103136
104-
### Usage
137+
## Documentation
105138
106139
See the [README.md](https://github.com/${{ github.repository }}) for detailed integration instructions and API documentation.
107140
108141
## What's Changed
109142
110-
See the [commit history](https://github.com/${{ github.repository }}/compare/{{ previousTag }}...${{ github.event.inputs.version }}) for a full list of changes.
143+
See the [commit history](https://github.com/${{ github.repository }}/compare/${{ steps.prev_tag.outputs.tag }}...${{ github.event.inputs.version }}) for a full list of changes.
111144
env:
112145
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,31 @@ ndk.version=29.0.13599879
7979

8080
### Android (Gradle)
8181

82-
You can add C2PA Android as a Gradle dependency:
82+
The library is available from two sources: **JitPack** (recommended for simplicity) and **GitHub Packages**.
83+
84+
#### Option 1: JitPack (Recommended)
85+
86+
Add JitPack to your repositories and include the dependency:
8387

8488
```gradle
89+
// In your settings.gradle or root build.gradle
90+
dependencyResolutionManagement {
91+
repositories {
92+
google()
93+
mavenCentral()
94+
maven { url 'https://jitpack.io' }
95+
}
96+
}
97+
98+
// In your app's build.gradle
8599
dependencies {
86-
implementation "org.contentauth:c2pa:1.0.0"
100+
implementation 'com.github.contentauth:c2pa-android:1.0.0'
87101
}
88102
```
89103

90-
Make sure to add the GitHub Packages repository to your project:
104+
#### Option 2: GitHub Packages
105+
106+
GitHub Packages requires authentication. Add the repository and dependency:
91107

92108
```gradle
93109
// In your root build.gradle
@@ -105,6 +121,11 @@ allprojects {
105121
}
106122
}
107123
}
124+
125+
// In your app's build.gradle
126+
dependencies {
127+
implementation "org.contentauth:c2pa:1.0.0"
128+
}
108129
```
109130

110131
#### Development Workflow for Android

jitpack.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
jdk:
2+
- openjdk17
3+
4+
before_install:
5+
- sdk install java 17.0.2-open
6+
- sdk use java 17.0.2-open
7+
8+
install:
9+
- ./gradlew :library:publishToMavenLocal

library/consumer-rules.pro

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,28 @@
1010
-keep interface org.contentauth.c2pa.SignCallback { *; }
1111

1212
# Java 17 compatibility
13-
-dontwarn java.lang.invoke.StringConcatFactory
13+
-dontwarn java.lang.invoke.StringConcatFactory
14+
15+
# kotlinx.serialization (used internally for JSON parsing)
16+
-keepattributes *Annotation*, InnerClasses
17+
-dontnote kotlinx.serialization.**
18+
-keepclassmembers class kotlinx.serialization.json.** {
19+
*** Companion;
20+
}
21+
-keepclasseswithmembers class kotlinx.serialization.json.** {
22+
kotlinx.serialization.KSerializer serializer(...);
23+
}
24+
-keep,includedescriptorclasses class org.contentauth.c2pa.**$$serializer { *; }
25+
-keepclassmembers class org.contentauth.c2pa.** {
26+
*** Companion;
27+
}
28+
29+
# BouncyCastle (used internally for CSR generation)
30+
-keep class org.bouncycastle.** { *; }
31+
-dontwarn org.bouncycastle.**
32+
33+
# OkHttp (used internally for web service signing)
34+
-dontwarn okhttp3.**
35+
-dontwarn okio.**
36+
-keep class okhttp3.** { *; }
37+
-keep interface okhttp3.** { *; }

0 commit comments

Comments
 (0)