chore: migrate publishing from OSSRH to Central Portal - #359
Conversation
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>
…/migrate-central-portal-publishing
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: Set up Maven Central Repository | ||
| uses: actions/setup-java@v2 |
There was a problem hiding this comment.
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 🧁
| needs: publish-dry-run | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 |
There was a problem hiding this comment.
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 found 7
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. ⚪️ This finding does not block your pull request. |
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>
Summary
nexus-staging-maven-pluginwithcentral-publishing-maven-plugin(v0.7.0) to publish viacentral.sonatype.comdistributionManagementin pom.xml to point to the new Central Portalworkflow_dispatchtrigger for manual publishing from GitHub Actions UIv*.*.*) and manual dispatchRequired Secrets Setup
Before publishing, configure these GitHub secrets:
CENTRAL_USERNAMECENTRAL_TOKENOSSRH_GPG_SECRET_KEYMAVEN_GPG_PASSPHRASETest plan
CENTRAL_USERNAMEandCENTRAL_TOKENsecrets to the repoworkflow_dispatchor push a version tag🤖 Generated with Claude Code