Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
adb2607
fix: implement HTTP requests for Central Portal API publishing
grablack Jul 29, 2025
764c0f8
speed up testing
grablack Jul 30, 2025
b8b5e09
fix: improve POM file lookup and error handling for Central Portal pu…
grablack Jul 30, 2025
7f884e1
fix: implement Maven Central publishing with official plugin
grablack Jul 30, 2025
4ca2b1d
fix: improve Maven Central publishing configuration
grablack Jul 30, 2025
bba2934
fix: correct YAML formatting in GitHub Action
grablack Jul 30, 2025
6b0c587
fix: add GPG signing for Maven artifacts
grablack Jul 30, 2025
861c676
fix: remove status check and improve output messages
grablack Jul 30, 2025
35084fa
fix: use correct artifactId for Maven Central publishing
grablack Jul 30, 2025
641b620
fix: set proper project name in Maven Central Portal UI
grablack Jul 30, 2025
d5f7be7
fix: add -SNAPSHOT suffix for snapshot releases
grablack Jul 30, 2025
659e2e8
fix: update display name to 'Messages' in Maven Central Portal
grablack Jul 30, 2025
d6899b7
docs: update PUBLISHING.md with manual approval instructions
grablack Jul 30, 2025
2ff7df6
prevent updating version for next run
grablack Jul 30, 2025
5d96d9f
fix: uncomment steps for installing dependencies and GitHub release i…
grablack Jul 30, 2025
ccbffad
feat: add generation of sources JAR in Maven Central publishing action
grablack Jul 30, 2025
bf42666
feat: enhance sources JAR generation with fallback mechanism and upda…
grablack Jul 30, 2025
2d6e3cd
feat: enable auto publishing for Maven Central in snapshot release wo…
grablack Jul 30, 2025
ecc6a45
feat: update publishing method to use Gradle for Maven Central Portal
grablack Jul 31, 2025
ef14f1f
Fix Gradle task dependency issue in Maven Central publishing
grablack Jul 31, 2025
5806f8a
remove files
grablack Jul 31, 2025
2b7973d
Fix GenerateModuleMetadata task dependency for sources JAR
grablack Jul 31, 2025
ff499fa
Fix duplicate sources JAR artifact issue by using Android plugin's re…
grablack Jul 31, 2025
146875f
Replace custom Maven Central API approach with NMCP plugin for proper…
grablack Jul 31, 2025
c17bce6
Fix YAML formatting error caused by tab characters in action
grablack Jul 31, 2025
0d3eaf6
Fix YAML parsing error in NMCP configuration
grablack Jul 31, 2025
58f10d4
Fix NMCP action configuration for publishing to Maven Central
grablack Jul 31, 2025
306afaa
Refactor NMCP configuration in action.yml for improved syntax and cla…
grablack Jul 31, 2025
8e17946
Refactor NMCP configuration script for improved clarity and structure
grablack Aug 4, 2025
8efdee4
Refactor NMCP configuration script for improved readability and struc…
grablack Aug 4, 2025
6cd3b13
Fix task dependency issue for signing archives
grablack Aug 4, 2025
11cf3e3
Enhance signing configuration checks and adjust task dependencies for…
grablack Aug 4, 2025
984a653
Add support for SNAPSHOT version publishing and enhance version handl…
grablack Aug 4, 2025
902dcf2
Add maven-publish plugin to build.gradle for artifact publishing
grablack Aug 4, 2025
2f168dc
Set group ID for the PayPal Messages library
grablack Aug 4, 2025
166572a
Add Maven publication configuration for release artifacts
grablack Aug 4, 2025
eec24d0
Add NMCP aggregation configuration for publishing to Sonatype Central…
grablack Aug 4, 2025
f54d77f
Remove NMCP aggregation configuration and update ZIP task duplicate h…
grablack Aug 4, 2025
7ec9389
Update SDK version to 1.1.1-SNAPSHOT and define POM_URL for project
grablack Aug 4, 2025
f166856
Update SDK version to 1.1.1
grablack Aug 4, 2025
2f8508d
Update version to 1.1.1 and enhance POM metadata for Maven publication
grablack Aug 4, 2025
8c26224
Enhance Maven Central publishing action to allow overwriting of relea…
grablack Aug 4, 2025
40c4727
Remove allowReleaseOverwrite setting from Maven Central publishing ac…
grablack Aug 4, 2025
55d4e76
Update signing configuration to sign all Maven publications
grablack Aug 4, 2025
0ed3d50
fix: update POM packaging type and dependency configuration
grablack Aug 4, 2025
52dbf5f
chore: update version to 1.1.1-SNAPSHOT in build.gradle and pom.xml
grablack Aug 4, 2025
0b890c7
fix: remove manual dependencies section from POM as it's automaticall…
grablack Aug 4, 2025
385d311
chore: update version to 1.1.2 in build.gradle and pom.xml; enable in…
grablack Aug 4, 2025
4f1ef0a
fix: disable auto publishing in release snapshots workflow
grablack Aug 4, 2025
7278e54
feat: add ProGuard rules for PayPal Messages SDK and update build.gra…
grablack Aug 6, 2025
71a5995
feat: Consolidate demo activities
grablack Aug 6, 2025
4b08e2a
refactor: Remove unused files and activities
grablack Aug 6, 2025
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
248 changes: 248 additions & 0 deletions .github/actions/publish_maven_central/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
name: 'Publish to Maven Central'
description: 'Publishes all modules using the Maven Central Portal Plugin'
inputs:
sonatype_user:
description: 'Sonatype user'
required: true
default: ''
sonatype_token:
description: 'Sonatype user token'
required: true
default: ''
signing_key_id:
description: 'Signing key id'
required: true
default: ''
signing_key_password:
description: 'Signing key password'
required: true
default: ''
signing_key_file:
description: 'Signing key file'
required: true
default: ''
auto_publish:
description: 'Whether to publish automatically'
required: false
default: 'true'
use_snapshot:
description: 'Whether to publish as a SNAPSHOT version'
required: false
default: 'false'
runs:
using: "composite"
steps:
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.9.5

- name: Create Maven settings directory
shell: bash
run: |
mkdir -p ${{ github.workspace }}/.mvn

- name: Create Maven settings file
shell: bash
run: |
cat > ${{ github.workspace }}/.mvn/maven-settings.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<username>${env.SONATYPE_NEXUS_USERNAME}</username>
<password>${env.SONATYPE_NEXUS_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<id>gpg</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>${env.SIGNING_KEY_ID}</gpg.keyname>
<gpg.passphrase>${env.SIGNING_KEY_PASSWORD}</gpg.passphrase>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>gpg</activeProfile>
</activeProfiles>
</settings>
EOF

- name: Prepare and publish
shell: bash
env:
SONATYPE_NEXUS_USERNAME: ${{ inputs.sonatype_user }}
SONATYPE_NEXUS_PASSWORD: ${{ inputs.sonatype_token }}
SIGNING_KEY_ID: ${{ inputs.signing_key_id }}
SIGNING_KEY_PASSWORD: ${{ inputs.signing_key_password }}
SIGNING_KEY_FILE: ${{ inputs.signing_key_file }}
USE_SNAPSHOT: ${{ inputs.use_snapshot }}
run: |
echo "Using Gradle publishing with Maven Central Portal"

# Verify we have the library module
if [ ! -d "${{ github.workspace }}/library" ]; then
echo "Error: library directory not found"
exit 1
fi

# Get version from build.gradle
VERSION=$(grep -o '"sdkVersionName"\s*:\s*"[^"]*"' ${{ github.workspace }}/build.gradle | grep -o '"[^"]*"$' | tr -d '"')

# Check if this is a snapshot release
if [ "$USE_SNAPSHOT" = "true" ]; then
# Add -SNAPSHOT suffix if it's not already there
if [[ "$VERSION" != *-SNAPSHOT ]]; then
VERSION="${VERSION}-SNAPSHOT"
fi
echo "Publishing SNAPSHOT version: $VERSION"
else
# Remove -SNAPSHOT suffix if it exists for release versions
if [[ "$VERSION" == *-SNAPSHOT ]]; then
VERSION="${VERSION%-SNAPSHOT}"
fi
echo "Publishing release version: $VERSION"
fi

# Get proper artifactId from library's build.gradle
ARTIFACT_ID=$(grep -o 'project.ext.name = "[^"]*"' ${{ github.workspace }}/library/build.gradle | grep -o '"[^"]*"$' | tr -d '"')
echo "Using artifactId: $ARTIFACT_ID"
echo "Publishing version: $VERSION"

# Check if this version might already exist
if [ "$USE_SNAPSHOT" != "true" ]; then
echo "⚠️ WARNING: Publishing release version $VERSION"
echo " If this version already exists on Maven Central, the publish will fail."
echo " Consider using use_snapshot: true for testing or increment the version number."
fi

# Import GPG key
echo "Importing GPG key for signing"
gpg --batch --import ${{ inputs.signing_key_file }}

# Apply NMCP plugin to root build.gradle for aggregation
echo "Configuring root build.gradle with NMCP plugin for Maven Central Portal"

# Backup the root build.gradle
cp ${{ github.workspace }}/build.gradle ${{ github.workspace }}/build.gradle.backup

# Create script file for awk
cat > ${{ github.workspace }}/awk-script.txt << 'EOF'
/^plugins \{/ {
print $0
print " id \"com.gradleup.nmcp.aggregation\" version \"1.0.2\""
next
}
{ print }
EOF

# Apply the awk script
awk -f ${{ github.workspace }}/awk-script.txt ${{ github.workspace }}/build.gradle.backup > ${{ github.workspace }}/build.gradle.tmp
mv ${{ github.workspace }}/build.gradle.tmp ${{ github.workspace }}/build.gradle

# Create a file with NMCP configuration
cat > ${{ github.workspace }}/nmcp-config.gradle << EOF
nmcpAggregation {
centralPortal {
username = System.getenv("SONATYPE_NEXUS_USERNAME")
password = System.getenv("SONATYPE_NEXUS_PASSWORD")
publishingType = "AUTOMATIC"
publicationName = "PayPal Messages Android"
}

// Publish the library project
publishAllProjectsProbablyBreakingProjectIsolation()
}

// Override the version for the publication and ensure POM metadata is included
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
version = "${VERSION}"
pom {
name = "PayPal Messages"
description = "The PayPal Android SDK Messages Module: Promote offers to your customers such as Pay Later and PayPal Credit."
url = "https://github.com/paypal/paypal-messages-android"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0"
}
}
developers {
developer {
id = "paypal-messages-android"
name = "PayPalMessages Android"
email = "[email protected]"
}
}
scm {
connection = "scm:git:git://github.com/paypal/paypal-messages-android.git"
developerConnection = "scm:git:ssh://github.com:paypal/paypal-messages-android.git"
url = "https://github.com/paypal/paypal-messages-android"
}
}
}
}
}
}

// Configure signing for all tasks
signing {
required { true }
sign publishing.publications
}
EOF

# Add NMCP configuration to the end of root build.gradle
cat ${{ github.workspace }}/nmcp-config.gradle >> ${{ github.workspace }}/build.gradle

# Clean before building to ensure fresh state
echo "Cleaning project..."
./gradlew clean

# Use NMCP aggregation to publish to Maven Central Portal
echo "Building and publishing with NMCP aggregation..."
./gradlew --stacktrace \
publishAggregationToCentralPortal \
-Psigning.keyId="${SIGNING_KEY_ID}" \
-Psigning.password="${SIGNING_KEY_PASSWORD}" \
-Psigning.secretKeyRingFile="${SIGNING_KEY_FILE}"

# Restore the original configurations
if [ -f "${{ github.workspace }}/gradle/gradle-publish.gradle.backup" ]; then
mv ${{ github.workspace }}/gradle/gradle-publish.gradle.backup ${{ github.workspace }}/gradle/gradle-publish.gradle
fi
if [ -f "${{ github.workspace }}/build.gradle.backup" ]; then
mv ${{ github.workspace }}/build.gradle.backup ${{ github.workspace }}/build.gradle
fi

# Print deployment information and next steps
echo "======================================================================"
echo "Deployment to Maven Central completed successfully."
echo "Your artifacts are now being published to Maven Central as:"
echo "com.paypal.messages:${ARTIFACT_ID}:${VERSION}"
echo ""
echo "The following artifacts were published:"
echo "- ${ARTIFACT_ID}-${VERSION}.aar (Android AAR)"
echo "- ${ARTIFACT_ID}-${VERSION}-sources.jar (Sources JAR)"
echo "- ${ARTIFACT_ID}-${VERSION}.module (Gradle Module Metadata)"
echo "- ${ARTIFACT_ID}-${VERSION}.pom (POM file)"
echo "- All signature (.asc) and checksum files"
echo ""
echo "Users can include this dependency with:"
echo "implementation(\"com.paypal.messages:${ARTIFACT_ID}:${VERSION}\")"
echo ""
echo "NOTE: After successful publishing, it may take several hours for"
echo "the artifacts to appear on Maven Central (https://repo.maven.apache.org/maven2)"
echo "and search indexes like mvnrepository.com or search.maven.org."
echo ""
echo "You can check the status of your deployment at:"
echo "https://central.sonatype.com/publishing/deployments"
echo "======================================================================"
8 changes: 4 additions & 4 deletions .github/workflows/release-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ jobs:
SIGNING_KEY_FILE: ${{ env.SIGNING_KEY_FILE_PATH }}
run: npx semantic-release@21

# Central Portal publishing method
- name: Publish to Central Portal
uses: ./.github/actions/publish_central_portal
# Maven Central publishing method using official plugin
- name: Publish to Maven Central
uses: ./.github/actions/publish_maven_central
with:
# Pass credentials directly as input parameters
sonatype_user: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatype_token: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
signing_key_id: ${{ secrets.SIGNING_KEY_ID }}
signing_key_password: ${{ secrets.SIGNING_KEY_PASSWORD }}
signing_key_file: ${{ env.SIGNING_KEY_FILE_PATH }}
auto_publish: 'true'
auto_publish: 'false'
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ jobs:
target_branch: develop
github_token: ${{ secrets.GITHUB_TOKEN }}

# Central Portal publishing method
- name: Publish to Central Portal
uses: ./.github/actions/publish_central_portal
# Maven Central publishing method using official plugin
- name: Publish to Maven Central
uses: ./.github/actions/publish_maven_central
with:
# Pass credentials directly as input parameters
sonatype_user: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatype_token: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
signing_key_id: ${{ secrets.SIGNING_KEY_ID }}
signing_key_password: ${{ secrets.SIGNING_KEY_PASSWORD }}
signing_key_file: ${{ env.SIGNING_KEY_FILE_PATH }}
auto_publish: 'true'
auto_publish: 'false'
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ node_modules/
# Recommended Ignores by JetBrains
# https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# .idea/ files are handled in .idea/.gitignore
connectedCheck.log
.idea/deploymentTargetSelector.xml
.idea/migrations.xml
.idea/other.xml
13 changes: 13 additions & 0 deletions .mvn/maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<!-- Use environment variables for credentials -->
<username>${env.SONATYPE_NEXUS_USERNAME}</username>
<password>${env.SONATYPE_NEXUS_PASSWORD}</password>
</server>
</servers>
</settings>
Loading
Loading