Skip to content

chore: migrate publishing from OSSRH to Central Portal - #359

Open
ankitdas13 wants to merge 12 commits into
masterfrom
chore/migrate-central-portal-publishing
Open

chore: migrate publishing from OSSRH to Central Portal#359
ankitdas13 wants to merge 12 commits into
masterfrom
chore/migrate-central-portal-publishing

Conversation

@ankitdas13

Copy link
Copy Markdown
Member

Summary

  • Replaced nexus-staging-maven-plugin with central-publishing-maven-plugin (v0.7.0) to publish via central.sonatype.com
  • Updated distributionManagement in pom.xml to point to the new Central Portal
  • Added workflow_dispatch trigger for manual publishing from GitHub Actions UI
  • Publish job now triggers on both version tags (v*.*.*) and manual dispatch

Required Secrets Setup

Before publishing, configure these GitHub secrets:

Secret Description
CENTRAL_USERNAME Token username from central.sonatype.com → Account → Generate User Token
CENTRAL_TOKEN Token password from central.sonatype.com → Account → Generate User Token
OSSRH_GPG_SECRET_KEY GPG private key (already exists)
MAVEN_GPG_PASSPHRASE GPG passphrase (already exists)

Test plan

🤖 Generated with Claude Code

ankitdas13 and others added 9 commits June 9, 2026 13:35
Replace nexus-staging-maven-plugin with central-publishing-maven-plugin
to publish via central.sonatype.com. Add workflow_dispatch trigger for
manual publishing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Runs on every push/PR to verify:
- Main JAR, sources JAR, and javadoc JAR are generated
- pom.xml has all required Central Portal metadata
- Version is non-SNAPSHOT

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Calls the Central Portal API to verify CENTRAL_USERNAME and
CENTRAL_TOKEN secrets are valid before attempting a real publish.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
setup-java's gpg-passphrase parameter sets the env var name that
maven-gpg-plugin reads the passphrase from, fixing sign failures in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds gpg-agent.conf setup and lists imported keys to debug
signing issues in the publish job.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Publish only on tag push (v*.*.*) or manual workflow_dispatch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/ci.yml Outdated
- uses: actions/checkout@v2

- name: Set up Maven Central Repository
uses: actions/setup-java@v2

@semgrep-code-razorpay semgrep-code-razorpay Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608.

🧁 Fixed in commit b2ace4a 🧁

Comment thread .github/workflows/ci.yml Outdated
needs: publish-dry-run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

@semgrep-code-razorpay semgrep-code-razorpay Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608.

🧼 Fixed in commit b2ace4a 🧼

Co-authored-by: ankitdas13 <ankit.das@razorpay.com>
@semgrep-code-razorpay

Copy link
Copy Markdown

Semgrep found 7 github-actions-mutable-action-tag findings:

GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608.

⚪️ This finding does not block your pull request.
Ignore this finding from github-actions-mutable-action-tag

ankitdas13 and others added 2 commits July 29, 2026 17:36
Switch probe to /publisher/status (auth-only) and treat non-2xx as
failure with retries on 5xx, so bad credentials or Portal outages
can no longer sail through the dry-run step as a warning.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The /publisher/status endpoint returns 500 with valid credentials
because it expects a deploymentId, so retrying on 5xx made the
step fail on healthy runs. Treat only 401/403 as "creds rejected";
any other response means the auth header was accepted and the real
validation will happen at deploy time.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant