Skip to content

Commit

Permalink
Maven snapshot publishing, pass 1
Browse files Browse the repository at this point in the history
  • Loading branch information
getorymckeag committed Nov 4, 2024
1 parent b8df1c1 commit 5cfead2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 16 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@ jobs:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
server-id: central # Maps to central-publishing-maven-plugin config.
# Maps to GitHub repository secret names.
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE

java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
run: mvn -B deploy --file pom.xml
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

54 changes: 39 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,47 @@
</execution>
</executions>
</plugin>
<!-- TODO: Enable for formal publishing to Maven Central
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin> -->

</plugins>
</build>

<profiles>
<profile>
<!-- Profile that activates plugins specifically needed for publishing to
Maven Central. Not required for general dev workflow -->
<id>publish</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.6.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
</plugins>
</build>

</profile>

</profiles>


</project>

0 comments on commit 5cfead2

Please sign in to comment.