Skip to content

Commit

Permalink
feat(SNSUN-3): add GithubAction to deploy to Maven central repository…
Browse files Browse the repository at this point in the history
… on release, adjust pom.xml for maven central deployment
  • Loading branch information
pjazdzyk committed May 29, 2023
1 parent 71fded1 commit d07c755
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/deploy-to-central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: deploy-to-maven-central
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Maven Library build and publish
uses: MathieuSoysal/Java-maven-library-publisher@v1.0.4
with:
nexus-username: ${{ secrets.NEXUS_USERNAME }}
nexus-password: ${{ secrets.NEXUS_PASSWORD }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
github-token: ${{ secrets.GITHUB_TOKEN }}
java-version: 17
127 changes: 126 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,29 @@

<groupId>com.synerset</groupId>
<artifactId>unitility</artifactId>
<version>0.1.1-beta</version>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>Unitility</name>
<description>The Physics Units of Measure Library for Java</description>
<url>https://github.com/pjazdzyk/unitility</url>

<licenses>
<license>
<name>MIT License</name>
<url>https://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>

<developers>
<developer>
<name>Piotr Jażdżyk</name>
<email>piotr.jazdzyk@o2.pl</email>
<organization>SYNERSET</organization>
<organizationUrl>https://www.synerset.com</organizationUrl>
</developer>
</developers>

<properties>
<!-- Sonar Cloud Properties-->
<sonar.organization>synerset</sonar.organization>
Expand Down Expand Up @@ -87,4 +107,109 @@
</plugins>
</build>

<profiles>
<profile>
<id>ossrhDeploy</id>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<build>
<plugins>
<!-- Sonatype Plugin -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

<!-- Maven Source Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Maven javadoc plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Maven GPG Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<!-- Profile : Github Apache Maven Packages -->
<profile>
<id>githubDeploy</id>
<distributionManagement>
<repository>
<id>github</id>
<name>pjazdzyk</name>
<url>https://maven.pkg.github.com/pjazdzyk/unitility</url>
</repository>
</distributionManagement>
</profile>

</profiles>

<scm>
<connection>scm:git:git://github.com/pjazdzyk/unitility.git</connection>
<developerConnection>scm:git:ssh://github.com:pjazdzyk/unitility.git</developerConnection>
<url>https://github.com/pjazdzyk/unitility</url>
<tag>HEAD</tag>
</scm>

</project>

0 comments on commit d07c755

Please sign in to comment.