Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
89 changes: 89 additions & 0 deletions .github/workflows/maven-ci.yml
Comment thread
thomasturrell marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Maven CI

on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch: {}

env:
MAVEN_OPTS: -Xmx2g

jobs:
build:
name: Build and Test (matrix)
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11, 17]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: maven

- name: Cache local Maven repo
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Build and run tests
run: mvn -B -U -e -DskipTests=false verify

publish:
name: Publish (snapshots/releases)
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: maven

- name: Configure GPG key (for releases)
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "$GPG_PRIVATE_KEY" | base64 --decode > private.key
gpg --batch --import private.key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY_BASE64 }}

- name: Deploy release to Maven Central
if: startsWith(github.ref, 'refs/tags/')
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
mvn -B -P release -DskipTests deploy -Dgpg.passphrase="$GPG_PASSPHRASE"

- name: Deploy snapshot to OSSRH (on main branch)
if: github.ref == 'refs/heads/main'
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: |
mvn -B -DskipTests deploy -P snapshot
32 changes: 0 additions & 32 deletions .github/workflows/maven-publish-snapshot.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/maven-publish.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/maven_pull_request.yml
Comment thread
thomasturrell marked this conversation as resolved.
Outdated

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/maven_push.yml
Comment thread
thomasturrell marked this conversation as resolved.
Outdated

This file was deleted.