-
Notifications
You must be signed in to change notification settings - Fork 5
Trigger automatic release to Maven Central #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rs/readme-catchup
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||||||||||||||||||||||||
|
|
@@ -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}" \ | ||||||||||||||||||||||||||||
| -H "Content-Type: application/json" \ | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| -H "Content-Type: application/json" \ |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
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.
| - 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 |
There was a problem hiding this comment.
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.