Skip to content

Commit

Permalink
move deploy config to build profile
Browse files Browse the repository at this point in the history
- profile also activated in the github action
  • Loading branch information
StaffanArvidsson committed Mar 15, 2023
1 parent e6f1da3 commit d279fe5
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Publish to Apache Maven Central
run: mvn deploy -DskipTests=true
run: mvn deploy -DskipTests=true -P deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
Expand Down
119 changes: 79 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -347,20 +347,6 @@
<version>${compiler.plugin.version}</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${source.plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand All @@ -369,6 +355,7 @@
<author>false</author>
<bottom><![CDATA[<i>Copyright &#169; 2022, <a href="https://arosbio.com">Aros Bio AB</a>. All Rights Reserved.</i>]]></bottom>
</configuration>
<!--
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -377,34 +364,10 @@
</goals>
</execution>
</executions>
-->
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${gpg.plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus.staging.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>


<!-- License management: updates the header of source files only
Run it using `mvn license:format` -->
Expand Down Expand Up @@ -444,4 +407,80 @@ CPSign is an Open Source Software that is dual licensed to allow you to choose a
</plugins>
</build>

<profiles>
<!-- Profile for deploying to the maven central repo - builds and signs all required artifacts -->
<profile>
<id>deploy</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>

<build>
<plugins>
<!-- TODO - not sure if we need to specify this again -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.plugin.version}</version>
<configuration>
<author>false</author>
<bottom><![CDATA[<i>Copyright &#169; 2022, <a href="https://arosbio.com">Aros Bio AB</a>. All Rights Reserved.</i>]]></bottom>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${source.plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${gpg.plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus.staging.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

</plugins>
</build>

</profile>
</profiles>

</project>

0 comments on commit d279fe5

Please sign in to comment.