From 9015f230ae3c7d8116ac04ae90375771602c8acd Mon Sep 17 00:00:00 2001 From: Yevgeni Tsodikov Date: Wed, 18 Sep 2024 13:12:50 +0300 Subject: [PATCH] Push to sonatype (#16) * Push to sonatype * No need to sign GPG in SNAPSHOT * Report `-P release` for SNAPSHOT * Update server params * Test `Main CI (Release)` on dummy `0.0.1-SNAPSHOT` version * [maven-release-plugin] prepare release aws-sdk-java-opentelemetry-metrics-0.0.1 * [maven-release-plugin] prepare for next development iteration * Undo temp `RELEASE` in branch * Add missing newline * Bump plugins to latest version, verify release * [maven-release-plugin] prepare release aws-sdk-java-opentelemetry-metrics-0.0.2 * [maven-release-plugin] prepare for next development iteration * Remove test branch from release CI * Test again, add `develops` section * [maven-release-plugin] prepare release aws-sdk-java-opentelemetry-metrics-0.0.3 * [maven-release-plugin] prepare for next development iteration * Add release profile * [maven-release-plugin] prepare release aws-sdk-java-opentelemetry-metrics-0.0.4 * [maven-release-plugin] prepare for next development iteration * Move `maven-gpg-plugin` under release * Update CI * [maven-release-plugin] prepare release aws-sdk-java-opentelemetry-metrics-0.0.5 * [maven-release-plugin] prepare for next development iteration * Remove `deploy` on branch, use `1.0.0-SNAPSHOT` --------- Co-authored-by: GitHub Actions --- .github/workflows/branch_ci.yml | 6 +++- .github/workflows/main_ci.yml | 24 +++++++++++++-- pom.xml | 52 ++++++++++++++++++++++++++------- 3 files changed, 68 insertions(+), 14 deletions(-) diff --git a/.github/workflows/branch_ci.yml b/.github/workflows/branch_ci.yml index b4e9290..0fe4a4c 100644 --- a/.github/workflows/branch_ci.yml +++ b/.github/workflows/branch_ci.yml @@ -39,6 +39,9 @@ jobs: java-version: '8' distribution: 'corretto' cache: maven + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD - name: Grant execute permission for Maven Wrapper run: chmod +x ./mvnw @@ -46,4 +49,5 @@ jobs: - name: Deploy SNAPSHOT run: ./mvnw --batch-mode -DskipTests -Darguments=-DskipTests deploy env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index 7f2daa3..bf2359d 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -28,6 +28,20 @@ jobs: java-version: '8' distribution: 'corretto' cache: maven + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + + - name: Set GPG Key for Signing + run: | + echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import + echo "default-key ${GPG_KEY_ID}" >> ~/.gnupg/gpg.conf + echo "use-agent" >> ~/.gnupg/gpg.conf + env: + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - name: Set Git user for release run: | @@ -40,6 +54,12 @@ jobs: - name: Bump Version and Release (Maven Release Plugin) run: | echo "Releasing and bumping version..." - ./mvnw release:prepare release:perform -Darguments=-DskipTests -B + ./mvnw \ + -Darguments=-DskipTests \ + -Dgpg.keyname=${{ secrets.GPG_KEY_ID }} \ + -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} \ + release:prepare release:perform -B -P release env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} diff --git a/pom.xml b/pom.xml index a3dc8ac..17ec49a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.appsflyer aws-sdk-java-opentelemetry-metrics - 1.0.1-SNAPSHOT + 1.0.0-SNAPSHOT AWS SDK Java OpenTelemetry Metrics OpenTelemetry Metric Publisher for AWS SDK for Java https://github.com/AppsFlyer/aws-sdk-java-opentelemetry-metrics @@ -23,15 +23,23 @@ HEAD + + + evg-tso + Yevgeni Tsodikov + evg.tso@gmail.com + + + 1.8 1.8 UTF-8 1.24.0 2.27.23 - 2.0.7 - 5.10.3 - 5.5.0 + 2.0.16 + 5.11.0 + 5.13.0 @@ -102,7 +110,7 @@ maven-compiler-plugin - 3.11.0 + 3.13.0 ${maven.compiler.source} ${maven.compiler.target} @@ -125,14 +133,14 @@ - github - GitHub Packages - https://maven.pkg.github.com/appsflyer/aws-sdk-java-opentelemetry-metrics + ossrh + OSSRH Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ - github - GitHub Packages - https://maven.pkg.github.com/appsflyer/aws-sdk-java-opentelemetry-metrics + ossrh + OSSRH Releases + https://oss.sonatype.org/service/local/staging/deploy/maven2/ @@ -176,6 +184,28 @@ + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.1.0 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + +