Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable auto publish #302

Merged
merged 9 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: Java CI
on: [push]
on:
push:
branches:
- master

env:
MAVEN_OPTS: -Dmaven.artifact.threads=256 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
- uses: actions/checkout@v4
- name: Setup Java JDK
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Pull Request
on: [pull_request]
on:
pull_request:
branches:
- master

env:
MAVEN_OPTS: -Dmaven.artifact.threads=256 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
jobs:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/sonatype-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Maven Release

on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: 'Cache Maven packages'
uses: actions/cache@v4
with:
path: ~/.m2
key: 'cache'
restore-keys: 'cache'

- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: 'Build with Maven'
run: mvn -B install --file pom.xml

- name: Release
uses: qcastel/github-actions-maven-release@master
env:
JAVA_HOME: /usr/lib/jvm/java-11-openjdk/
with:
git-release-bot-name: "angeliski"
git-release-bot-email: "[email protected]"

maven-args: "-DskipTests -PsonatypeDeploy"
maven-servers: ${{ secrets.MVN_REPO_SERVERS }}
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

gpg-enabled: true
gpg-key-id: ${{ secrets.GPG_KEY_ID }}
gpg-key: ${{ secrets.GPG_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: 'Remove Snapshots Before Caching'
run: find ~/.m2 -name '*SNAPSHOT' | xargs rm -Rf
66 changes: 66 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<scmCommentPrefix>[ci skip]</scmCommentPrefix>
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</pluginManagement>

Expand Down Expand Up @@ -435,6 +443,64 @@
</pluginManagement>
</build>
</profile>
<profile>
<!-- required, used in .github/workflows/sonatype-publish.yml -->
<id>sonatypeDeploy</id>
<properties>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
<gpg.keyname>${env.GPG_KEY_ID}</gpg.keyname>
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<!-- we need to release from staging to avoid errors and ensure double check -->
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<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>
</profiles>

<scm>
Expand Down