Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 4 additions & 5 deletions .github/workflows/pull-request-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 8
uses: actions/setup-java@v2
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '8'
java-version: '11'
distribution: 'zulu'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Test with Gradle
run: ./gradlew test:test --stacktrace

40 changes: 15 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,27 @@ jobs:
name: Release
runs-on: ubuntu-latest
needs: [authorize]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: amplitude-sdk-bot
GIT_AUTHOR_EMAIL: amplitude-sdk-bot@users.noreply.github.com
GIT_COMMITTER_NAME: amplitude-sdk-bot
GIT_COMMITTER_EMAIL: amplitude-sdk-bot@users.noreply.github.com
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}

- name: Set up JDK 8
uses: actions/setup-java@v3
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '8'
java-version: '11'
distribution: 'zulu'

- name: Build
Expand All @@ -42,18 +53,8 @@ jobs:
- name: Test
run: ./gradlew test --info

- name: Configure GPG
run: |
echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > 'secring.gpg'

- name: Semantic Release --dry-run
if: ${{ github.event.inputs.dryRun == 'true'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: amplitude-sdk-bot
GIT_AUTHOR_EMAIL: amplitude-sdk-bot@users.noreply.github.com
GIT_COMMITTER_NAME: amplitude-sdk-bot
GIT_COMMITTER_EMAIL: amplitude-sdk-bot@users.noreply.github.com
run: |
npx \
-p lodash \
Expand All @@ -66,17 +67,6 @@ jobs:

- name: Semantic Release
if: ${{ github.event.inputs.dryRun == 'false'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: amplitude-sdk-bot
GIT_AUTHOR_EMAIL: amplitude-sdk-bot@users.noreply.github.com
GIT_COMMITTER_NAME: amplitude-sdk-bot
GIT_COMMITTER_EMAIL: amplitude-sdk-bot@users.noreply.github.com
SECURE_REPO_USER: ${{ secrets.OSSRH_USERNAME }}
SECURE_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_RING_FILE: ../../secring.gpg
run: |
npx \
-p lodash \
Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id 'com.vanniktech.maven.publish' version '0.33.0' apply false
}
26 changes: 16 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
ARTIFACT_VERSION=1.13.0
ARTIFACT_GROUP=com.amplitude
POM_PACKAGING=jar
VERSION_NAME=1.13.0
GROUP=com.amplitude
POM_ARTIFACT_ID=java-sdk

mavenCentralPublishing=true
mavenCentralAutomaticPublishing=true
signAllPublications=true

POM_NAME=Amplitude Java SDK
POM_DESCRIPTION=Amplitude Java SDK
POM_URL=https://github.com/amplitude/Amplitude-Java

POM_SCM_URL=https://github.com/amplitude/Amplitude-Java
POM_SCM_CONNECTION=scm:git:http://github.com/amplitude/Amplitude-Java
POM_SCM_DEV_CONNECTION=scm:git:git@github.com:amplitude/Amplitude-Java.git
POM_LICENCE_NAME=The MIT License
POM_LICENCE_URL=http://www.opensource.org/licenses/mit-license.php
POM_LICENCE_DIST=repo

POM_LICENSE_NAME=The MIT License
POM_LICENSE_URL=http://www.opensource.org/licenses/mit-license.php
POM_LICENSE_DIST=repo

POM_DEVELOPER_ID=amplitude_sdk_dev
POM_DEVELOPER_NAME=Amplitude SDK Developers
POM_DEVELOPER_EMAIL=sdk.dev@amplitude.com
POM_DEVELOPER_ORG=Amplitude
POM_DEVELOPER_ORG_URL=https://amplitude.com/
RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots/
POM_DEVELOPER_URL=https://amplitude.com/
11 changes: 3 additions & 8 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module.exports = {
"replacements": [
{
"files": ["gradle.properties"],
"from": "ARTIFACT_VERSION=.*",
"to": "ARTIFACT_VERSION=${nextRelease.version}",
"from": "VERSION_NAME=.*",
"to": "VERSION_NAME=${nextRelease.version}",
"results": [
{
"file": "gradle.properties",
Expand Down Expand Up @@ -58,12 +58,7 @@ module.exports = {
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
["@semantic-release/exec", {
"publishCmd": `./gradlew publishMavenJavaPublicationToMySecureRepository \
-PmySecureRepositoryUsername="$SECURE_REPO_USER" \
-PmySecureRepositoryPassword="$SECURE_REPO_PASSWORD" \
-Psigning.keyId="$SIGNING_KEY_ID" \
-Psigning.password="$SIGNING_PASSWORD" \
-Psigning.secretKeyRingFile="$SIGNING_SECRET_RING_FILE"`,
"publishCmd": "./gradlew publishAndReleaseToMavenCentral --no-configuration-cache",
}],
],
}
7 changes: 7 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}

rootProject.name = 'java-sdk'
include 'main'
project(':main').projectDir = file('src/main')
Expand Down
62 changes: 10 additions & 52 deletions src/main/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar

plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.vanniktech.maven.publish'
}

compileJava {
Expand All @@ -11,11 +13,10 @@ compileJava {

apply plugin: 'idea'

group ARTIFACT_GROUP
version ARTIFACT_VERSION
group GROUP
version VERSION_NAME

repositories {
jcenter()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
Expand All @@ -35,51 +36,8 @@ dependencies {
implementation 'org.json:json:20231013'
}

java {
withSourcesJar()
withJavadocJar()
}

// ======== For SDK Releases ========
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'java-sdk'
from components.java
pom {
name = POM_DESCRIPTION
description = POM_DESCRIPTION
url = POM_URL
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
}
}
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
}
}
}
repositories {
maven {
name = 'mySecureRepository'
credentials(org.gradle.api.credentials.PasswordCredentials)
url = uri(RELEASE_REPOSITORY_URL)
}
}
}

signing {
sign publishing.publications.mavenJava
mavenPublishing {
configure(
new JavaLibrary(new JavadocJar.Javadoc(), true)
)
}
Loading