From ba402ed38a030026fb873f2844f960549b533afc Mon Sep 17 00:00:00 2001 From: Adam Ruberti Date: Sat, 29 Jun 2024 16:31:42 +0200 Subject: [PATCH] ci: add deployment to Maven Central (#49) Additionally: - obsolete deployment to S3 bucket was removed - pom.xml was extended with expected by Maven Central properties --- .github/workflows/maven-release.yml | 38 +++++++++++++++++++++-------- LICENSES/SBB.txt | 1 + app/pom.xml | 6 ++++- pom.xml | 32 +++++++++++++++++++++++- pom/pom.xml | 16 +++++++++++- 5 files changed, 80 insertions(+), 13 deletions(-) diff --git a/.github/workflows/maven-release.yml b/.github/workflows/maven-release.yml index a0ba37c..8bade5b 100644 --- a/.github/workflows/maven-release.yml +++ b/.github/workflows/maven-release.yml @@ -10,14 +10,19 @@ jobs: contents: read packages: write steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Set up JDK and Maven - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4 with: distribution: adopt java-version: 17 cache: maven - - uses: whelk-io/maven-settings-xml-action@9dc09b23833fa9aa7f27b63db287951856f3433d # v22 + # server-id: ossrh + # server-username: OSSRH_USERNAME + # server-password: OSSRH_PASSWORD + gpg-private-key: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }} + # gpg-passphrase: SIGN_KEY_PASS + - uses: whelk-io/maven-settings-xml-action@9dc09b23833fa9aa7f27b63db287951856f3433d # v22 with: repositories: > [ @@ -42,22 +47,31 @@ jobs: "id": "github", "username": "${env.GITHUB_ACTOR}", "password": "${env.GITHUB_TOKEN}" + }, + { + "id": "ossrh", + "username": "${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_USERNAME }}", + "password": "${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN }}" + }, + { + "id": "gpg.passphrase", + "passphrase": "${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }}" } ] profiles: > [ { - "id": "s3Deploy", + "id": "githubDeploy", "properties": { - "altDeploymentRepository": "s3::default::s3://sbb-polarion-maven-repo/polarion.mvn" + "altDeploymentRepository": "github::default::https://maven.pkg.github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic" } }, { - "id": "githubDeploy", + "id": "mavenCentralDeploy", "properties": { - "altDeploymentRepository": "github::default::https://maven.pkg.github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic" + "altDeploymentRepository": "ossrh::default::https://s01.oss.sonatype.org/content/repositories/releases/" } } ] @@ -68,11 +82,15 @@ jobs: - name: Extract artefact version id: artefact_version run: echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT - - name: Publish to S3 bucket - if: ${{ !endsWith(steps.artefact_version.outputs.version, '-SNAPSHOT') && github.ref == 'refs/heads/main' }} - run: mvn --batch-mode deploy -Ps3Deploy - name: Publish to GitHub Packages if: ${{ !endsWith(steps.artefact_version.outputs.version, '-SNAPSHOT') && github.ref == 'refs/heads/main' }} run: mvn --batch-mode deploy -PgithubDeploy env: GITHUB_TOKEN: ${{ github.token }} + - name: Publish to Maven Central + if: ${{ !endsWith(steps.artefact_version.outputs.version, '-SNAPSHOT') && github.ref == 'refs/heads/main' }} + run: mvn --batch-mode deploy -PmavenCentralDeploy + # env: + # SIGN_KEY_PASS: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }} + # OSSRH_USERNAME: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_USERNAME }} + # OSSRH_PASSWORD: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN }} diff --git a/LICENSES/SBB.txt b/LICENSES/SBB.txt index 876a005..f1cdf0a 100644 --- a/LICENSES/SBB.txt +++ b/LICENSES/SBB.txt @@ -1,4 +1,5 @@ Copyright 2024 SBB AG and contributors +Version 1.0 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/app/pom.xml b/app/pom.xml index 207bd8a..667f136 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -39,7 +39,11 @@ org.jacoco jacoco-maven-plugin + + + org.apache.maven.plugins + maven-gpg-plugin + - diff --git a/pom.xml b/pom.xml index 4919d69..b32dd09 100644 --- a/pom.xml +++ b/pom.xml @@ -7,9 +7,39 @@ 5.0.1-SNAPSHOT pom + Generic extension of Polarion ALM + This is a Polarion extension which provides common part to other extensions reducing code duplication + https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic + + + + The SBB License, Version 1.0 + https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic/blob/main/LICENSES/SBB.txt + + + + + + SBB Polarion Team + polarion-opensource@sbb.ch + SBB AG + http://www.sbb.ch + + + + + scm:git:git://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic.git + scm:git:ssh://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic.git + http://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic/tree/main + + + + GitHub + https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic/issues + + pom app - diff --git a/pom/pom.xml b/pom/pom.xml index 086ca3d..d12940a 100644 --- a/pom/pom.xml +++ b/pom/pom.xml @@ -22,6 +22,7 @@ 3.4.2 3.7.1 3.3.0 + 3.2.4 5.10.3 @@ -431,6 +432,20 @@ + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + + sign-artifacts + verify + + sign + + + + org.apache.maven.plugins @@ -544,5 +559,4 @@ -