Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 55 additions & 42 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Build and Test with Gradle
run: ./gradlew build
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: sdk/build/
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
- name: Build and Test with Gradle
run: ./gradlew build
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: sdk/build/

publish:
needs: build
Expand All @@ -29,32 +29,45 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Download Build
uses: actions/download-artifact@v4
with:
name: build
path: sdk/build/
- name: Import Signing Key
run: echo "${{ secrets.GPG_KEY_BASE64 }}" | base64 -d | gpg --batch --import
- name: Export Secret Key Ring
run: gpg --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSWORD }}" --export-secret-keys 0F95489EF8E0C0DA > /home/runner/.gnupg/secring.gpg
- name: Generate Gradle Properties
run: |
cat << EOF > ./gradle.properties
android.useAndroidX=true
nexusUsername=${{ secrets.NEXUS_USERNAME }}
nexusPassword=${{ secrets.NEXUS_PASSWORD }}
signing.keyId=F8E0C0DA
signing.password=${{ secrets.GPG_PASSWORD }}
signing.secretKeyRingFile=/home/runner/.gnupg/secring.gpg
EOF
- name: Publish package
run: ./gradlew publish -Pversion=${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
- name: Download Build
uses: actions/download-artifact@v4
with:
name: build
path: sdk/build/
- name: Import Signing Key
run: echo "${{ secrets.GPG_KEY_BASE64 }}" | base64 -d | gpg --batch --import
- name: Export Secret Key Ring
run: gpg --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSWORD }}" --export-secret-keys 0F95489EF8E0C0DA > /home/runner/.gnupg/secring.gpg
- name: Generate Gradle Properties
run: |
cat << EOF > ./gradle.properties
android.useAndroidX=true
nexusUsername=${{ secrets.NEXUS_USERNAME }}
nexusPassword=${{ secrets.NEXUS_PASSWORD }}
signing.keyId=F8E0C0DA
signing.password=${{ secrets.GPG_PASSWORD }}
signing.secretKeyRingFile=/home/runner/.gnupg/secring.gpg
EOF
- name: Publish package
run: ./gradlew publish -Pversion=${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger automatic release to Maven Central
run: |
# Create base64 encoded token from nexus credentials
TOKEN=$(echo -n "${{ secrets.NEXUS_USERNAME }}:${{ secrets.NEXUS_PASSWORD }}" | base64)

# Trigger automatic release via OSSRH Staging API
curl -X POST \
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.adzerk?publishing_type=automatic" \
-H "Authorization: Bearer ${TOKEN}" \

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Authorization header is incorrectly using "Bearer" token scheme with a Basic Authentication token. The base64-encoded username:password combination should use the "Basic" scheme, not "Bearer". The header should be "-H "Authorization: Basic ${TOKEN}"" instead. Bearer tokens are typically used for OAuth 2.0 access tokens, not for Basic Authentication credentials.

Suggested change
-H "Authorization: Bearer ${TOKEN}" \
-H "Authorization: Basic ${TOKEN}" \

Copilot uses AI. Check for mistakes.
-H "Content-Type: application/json" \

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curl command specifies "Content-Type: application/json" but doesn't include any request body with the -d or --data flag. If this endpoint expects JSON data, a request body should be provided. If no body is needed, the Content-Type header should be removed to avoid confusion.

Suggested change
-H "Content-Type: application/json" \

Copilot uses AI. Check for mistakes.
-w "\nHTTP Status: %{http_code}\n" \
-v
continue-on-error: false
Comment on lines +61 to +73

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API endpoint appears to be incorrect. The gradle configuration in sdk/build.gradle uses the URL "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" for publishing releases, but this curl command uses "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.adzerk?publishing_type=automatic". The "/manual/upload/" endpoint path does not match the standard OSSRH staging repository structure. The correct approach for triggering automatic release would typically involve using the Nexus Staging REST API to promote a staging repository, not a manual upload endpoint. Consider verifying the correct API endpoint for triggering automatic releases in the OSSRH documentation.

Suggested change
- name: Trigger automatic release to Maven Central
run: |
# Create base64 encoded token from nexus credentials
TOKEN=$(echo -n "${{ secrets.NEXUS_USERNAME }}:${{ secrets.NEXUS_PASSWORD }}" | base64)
# Trigger automatic release via OSSRH Staging API
curl -X POST \
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.adzerk?publishing_type=automatic" \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-w "\nHTTP Status: %{http_code}\n" \
-v
continue-on-error: false

Copilot uses AI. Check for mistakes.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ sdk.firePixel(clickUrl, listener);
```

Modifying the revenue

```kotlin
// Click pixel; fire when user clicks on the ad and modify the click revenue
// OVERRIDE: replaces the revenue value of the click/event
Expand All @@ -80,6 +81,7 @@ sdk.firePixel(clickUrl, revenue, RevenueModifierType.OVERRIDE, null, listener);
```

Setting the gross merchandise value for the event.

```kotlin
// Click pixel; fire when user clicks on the ad and modify the click revenue
// OVERRIDE: replaces the revenue value of the click/event
Expand All @@ -90,6 +92,7 @@ sdk.firePixel(clickUrl, revenue, RevenueModifierType.ADDITIONAL, grossMerchandis
```

Handle the fire pixel response

```kotlin
// status: HTTP status code
// location: click target URL
Expand All @@ -102,6 +105,7 @@ public void success(FirePixelResponse response) {
```

## Additional Options

Additional optional parameters supported by the API may be specified via the Builder on the Request or Placement.

Example: to specify eCPM partitions for a Placement:
Expand Down Expand Up @@ -131,6 +135,7 @@ val request = new Request.Builder()
```

## Multi-Winner Placements

A multi-winner placement returns multiple selections inside a single placement object.

To request multiple winners, specify a count for the Placement object. This requests the maximum number of winners (selections) that can be included in the placement.
Expand All @@ -157,24 +162,29 @@ Request request = new Request.Builder(placements)
@since SDK v0.4.0+

## Building

Use gradlew to build library archive

```
./gradlew assemble
```

output: `sdk/build/outputs/aar`

## Testing

Run unit tests

```
./gradlew test --rerun-tasks
```

Specify `--rerun-tasks` to rerun up-to-date tests. To view test reports see:

output: `sdk/build/reports/tests`

## Documentation

Generate the SDK documentation

```
Expand All @@ -184,16 +194,19 @@ Generate the SDK documentation
output: `sdk/build/docs/javadoc`

## Publishing

Publishing to Maven Central is automated via GitHub Actions. When a new GitHub release is created, the [publish workflow](.github/workflows/publish.yml) will build, sign, and publish the package to Sonatype OSSRH. The version is derived from the release tag name.

The workflow requires the following repository secrets:

- `GPG_KEY_BASE64` - base64-encoded GPG signing key
- `GPG_PASSWORD` - passphrase for the GPG key
- `NEXUS_USERNAME` / `NEXUS_PASSWORD` - Sonatype OSSRH credentials

Check on https://central.sonatype.com/artifact/com.adzerk/sdk that current version matches the released one when the publish GHA has finished.

To publish to local Maven repository for testing:

```
./gradlew publishToMavenLocal
```

Login to Sonatype OSSRH, locate the staging package, and release it.