-
Notifications
You must be signed in to change notification settings - Fork 370
Central Portal Migration #865
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
Open
jaredmixpanel
wants to merge
9
commits into
master
Choose a base branch
from
jared-central-portal-migration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
61dcce4
update to central portal
jaredmixpanel a34a6d1
review tweaks
jaredmixpanel 0d43526
ossrh staging api working checkpoint
jaredmixpanel 738309c
update release.sh script
jaredmixpanel ed9ff7e
update github workflow
jaredmixpanel 4b84002
workflow perms
jaredmixpanel 6121c69
workflow secrets update
jaredmixpanel 3092da8
put -SNAPSHOT back into gradle.properties
jaredmixpanel 87b3fee
put -SNAPSHOT back into gradle.properties
jaredmixpanel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
name: Publish to Maven Central | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
publishing_type: | ||
description: 'Publishing type for the deployment' | ||
required: true | ||
default: 'user_managed' | ||
type: choice | ||
options: | ||
- user_managed | ||
- automatic | ||
version_override: | ||
description: 'Version to publish (leave empty to use gradle.properties VERSION_NAME)' | ||
required: false | ||
type: string | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
publish: | ||
name: Publish to Maven Central Portal | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Configure signing | ||
env: | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
run: | | ||
echo "signing.keyId=${{ secrets.SIGNING_KEY_ID }}" >> ~/.gradle/gradle.properties | ||
echo "signing.password=$SIGNING_PASSWORD" >> ~/.gradle/gradle.properties | ||
echo "signing.secretKeyRingFile=$HOME/.gnupg/secring.gpg" >> ~/.gradle/gradle.properties | ||
mkdir -p ~/.gnupg | ||
echo "$SIGNING_KEY" | base64 --decode > ~/.gnupg/secring.gpg | ||
|
||
- name: Configure Portal credentials | ||
env: | ||
CENTRAL_PORTAL_TOKEN: ${{ secrets.CENTRAL_PORTAL_TOKEN }} | ||
CENTRAL_PORTAL_PASSWORD: ${{ secrets.CENTRAL_PORTAL_PASSWORD }} | ||
run: | | ||
echo "centralPortalToken=$CENTRAL_PORTAL_TOKEN" >> ~/.gradle/gradle.properties | ||
echo "centralPortalPassword=$CENTRAL_PORTAL_PASSWORD" >> ~/.gradle/gradle.properties | ||
|
||
- name: Override version if specified | ||
if: inputs.version_override != '' | ||
run: | | ||
sed -i "s/VERSION_NAME=.*/VERSION_NAME=${{ inputs.version_override }}/" gradle.properties | ||
echo "Updated version to: ${{ inputs.version_override }}" | ||
|
||
- name: Build artifacts | ||
run: | | ||
./gradlew clean build | ||
./gradlew androidJavadocsJar androidSourcesJar | ||
|
||
- name: Publish to Maven Central Portal | ||
run: ./gradlew publishRelease | ||
|
||
- name: Upload to Maven Central Portal | ||
env: | ||
CENTRAL_PORTAL_TOKEN: ${{ secrets.CENTRAL_PORTAL_TOKEN }} | ||
CENTRAL_PORTAL_PASSWORD: ${{ secrets.CENTRAL_PORTAL_PASSWORD }} | ||
run: | | ||
# Get the namespace from gradle.properties | ||
NAMESPACE=$(grep "^GROUP=" gradle.properties | cut -d'=' -f2) | ||
|
||
# Create Bearer auth token (as per docs) | ||
AUTH_TOKEN=$(echo -n "$CENTRAL_PORTAL_TOKEN:$CENTRAL_PORTAL_PASSWORD" | base64) | ||
|
||
# Call the manual upload endpoint | ||
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \ | ||
-H "Authorization: Bearer $AUTH_TOKEN" \ | ||
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/${NAMESPACE}?publishing_type=${{ inputs.publishing_type }}") | ||
|
||
HTTP_CODE=$(echo "$RESPONSE" | tail -n 1) | ||
BODY=$(echo "$RESPONSE" | sed '$d') | ||
|
||
if [ "$HTTP_CODE" != "200" ] && [ "$HTTP_CODE" != "201" ] && [ "$HTTP_CODE" != "204" ]; then | ||
echo "Error: Portal upload failed with HTTP $HTTP_CODE" | ||
echo "Response: $BODY" | ||
exit 1 | ||
fi | ||
|
||
echo "Success! Deployment uploaded to Portal." | ||
|
||
- name: Summary | ||
run: | | ||
VERSION=$(grep "^VERSION_NAME=" gradle.properties | cut -d'=' -f2) | ||
echo "## Publishing Summary" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo "- **Version**: $VERSION" >> $GITHUB_STEP_SUMMARY | ||
echo "- **Publishing Type**: ${{ inputs.publishing_type }}" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
if [ "${{ inputs.publishing_type }}" == "user_managed" ]; then | ||
echo "### Next Steps" >> $GITHUB_STEP_SUMMARY | ||
echo "1. Go to [Maven Central Portal Deployments](https://central.sonatype.com/publishing/deployments)" >> $GITHUB_STEP_SUMMARY | ||
echo "2. Find your deployment (version $VERSION)" >> $GITHUB_STEP_SUMMARY | ||
echo "3. Review and click 'Publish' to release to Maven Central" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo "⏱️ **Timeline**:" >> $GITHUB_STEP_SUMMARY | ||
echo "- Validation: 15-30 minutes" >> $GITHUB_STEP_SUMMARY | ||
echo "- Portal search: 1-2 hours" >> $GITHUB_STEP_SUMMARY | ||
echo "- Maven Central sync: 2-4 hours" >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo "### Status" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Deployment will be automatically released if validation passes" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo "⏱️ **Timeline**:" >> $GITHUB_STEP_SUMMARY | ||
echo "- Validation and release: 15-30 minutes" >> $GITHUB_STEP_SUMMARY | ||
echo "- Portal search: 1-2 hours" >> $GITHUB_STEP_SUMMARY | ||
echo "- Maven Central sync: 2-4 hours" >> $GITHUB_STEP_SUMMARY | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This has not yet been tested. We will still release via the release.sh script for now, but this is a start.