Skip to content

Commit

Permalink
ci: add deployment to Maven Central (#49)
Browse files Browse the repository at this point in the history
Additionally: 
- obsolete deployment to S3 bucket was removed
- pom.xml was extended with expected by Maven Central properties
  • Loading branch information
ariwk authored Jun 29, 2024
1 parent 23a96ed commit ba402ed
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 13 deletions.
38 changes: 28 additions & 10 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
[
Expand All @@ -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/"
}
}
]
Expand All @@ -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 }}
1 change: 1 addition & 0 deletions LICENSES/SBB.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 5 additions & 1 deletion app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
32 changes: 31 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,39 @@
<version>5.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Generic extension of Polarion ALM</name>
<description>This is a Polarion extension which provides common part to other extensions reducing code duplication</description>
<url>https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic</url>

<licenses>
<license>
<name>The SBB License, Version 1.0</name>
<url>https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic/blob/main/LICENSES/SBB.txt</url>
</license>
</licenses>

<developers>
<developer>
<name>SBB Polarion Team</name>
<email>[email protected]</email>
<organization>SBB AG</organization>
<organizationUrl>http://www.sbb.ch</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic.git</connection>
<developerConnection>scm:git:ssh://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic.git</developerConnection>
<url>http://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic/tree/main</url>
</scm>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.generic/issues</url>
</issueManagement>

<modules>
<module>pom</module>
<module>app</module>
</modules>

</project>
16 changes: 15 additions & 1 deletion pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
<maven-dependency-plugin.version>3.7.1</maven-dependency-plugin.version>
<exec-maven-plugin.version>3.3.0</exec-maven-plugin.version>
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>

<!-- Test dependencies -->
<junit.version>5.10.3</junit.version>
Expand Down Expand Up @@ -431,6 +432,20 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -544,5 +559,4 @@
</plugins>
</pluginManagement>
</build>

</project>

0 comments on commit ba402ed

Please sign in to comment.