Skip to content

Batch Central Publishing #27

Batch Central Publishing

Batch Central Publishing #27

name: Batch Central Publishing
on:
workflow_dispatch:
inputs:
centralRelease:
type: boolean
description: Run a release to Maven Central (requires secrets)
default: true
skipTests:
type: boolean
description: Skip tests during the build
default: true
# ── BOM Deployments ─────────────────────────────
deployVersioner:
type: boolean
description: Deploy the Versioner BOM (foundation for all other BOMs)
default: true
deployGuicedeeBoms:
type: boolean
description: Deploy GuicedEE BOMs and Parent POM
default: true
deployJwebmpBoms:
type: boolean
description: Deploy JWebMP BOM and Parent POM
default: true
# ── Project Profiles ────────────────────────────
profileGuicedee:
type: boolean
description: Include the 'guicedee' profile (GuicedEE modules)
default: true
profileServices:
type: boolean
description: Include the 'services' profile (service wrappers)
default: true
profileEntityassist:
type: boolean
description: Include the 'entityassist' profile
default: true
profileJwebmp:
type: boolean
description: Include the 'jwebmp' profile (JWebMP modules)
default: true
profileWebsites:
type: boolean
description: Include the 'websites' profile
default: true
profileActivityMaster:
type: boolean
description: Include the 'activity-master' profile
default: true
permissions:
contents: read
packages: write
pull-requests: write
checks: write
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
jobs:
publish:
runs-on: ubuntu-latest
name: Batch Central Publishing
steps:
# ── Checkout with all submodules ────────────────
- uses: actions/checkout@v6.0.2
with:
submodules: 'recursive'
fetch-depth: 0
show-progress: true
token: ${{ secrets.BUILD_TOKEN }}
# ── Setup Java 25 (required by project) ─────────
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'oracle'
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
# ── Cache Maven packages ────────────────────────
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
# ── Setup Maven 4.0.0-rc-5 (required by project) ─
- name: Setup Maven
uses: actionctl/setup-maven-cli@v1
with:
maven_version: '4.0.0-rc-5'
download_url_pattern: 'https://dlcdn.apache.org/maven/maven-4/4.0.0-rc-5/binaries/apache-maven-4.0.0-rc-5-bin.tar.gz'
# ── Configure Maven Settings ───────────────────
- name: Update Settings.xml
uses: s4u/maven-settings-action@45b6ca948aeeb205adebe97c67b26e2b50896844 # v4.0.0
with:
sonatypeSnapshots: true
servers: >
[
{
"id": "github",
"username": "${{ secrets.USERNAME }}",
"password": "${{ secrets.USER_TOKEN }}"
},
{
"id": "packages",
"username": "${{ secrets.USERNAME }}",
"password": "${{ secrets.USER_TOKEN }}"
},
{
"id": "packages_jwebmp",
"username": "${{ secrets.USERNAME }}",
"password": "${{ secrets.USER_TOKEN }}"
},
{
"id": "sona-snapshot",
"username": "${{ secrets.SONA_USERNAME }}",
"password": "${{ secrets.SONA_PASSWORD }}"
},
{
"id": "sona-release",
"username": "${{ secrets.SONA_USERNAME }}",
"password": "${{ secrets.SONA_PASSWORD }}"
},
{
"id": "central",
"username": "${{ secrets.SONA_USERNAME }}",
"password": "${{ secrets.SONA_PASSWORD }}"
}
]
repositories: >
[
{
"id": "packages",
"name": "packages",
"url": "https://maven.pkg.github.com/GuicedEE/Packages",
"releases": { "enabled": "true" },
"snapshots": { "enabled": "true" }
},
{
"id": "packages_jwebmp",
"name": "packages_jwebmp",
"url": "https://maven.pkg.github.com/JWebMP/Packages",
"releases": { "enabled": "true" },
"snapshots": { "enabled": "true" }
},
{
"id": "shibboleth",
"name": "shibboleth",
"url": "https://build.shibboleth.net/nexus/content/repositories/releases",
"releases": { "enabled": "true" },
"snapshots": { "enabled": "true" }
}
]
# ── Build Active Profiles per Namespace ──────────
# Central Publishing requires one namespace per deployment, so we split
# GuicedEE (com.guicedee), JWebMP (com.jwebmp), and Activity Master into separate runs.
# BOMs are also deployed separately from modules (POM-only artifacts need their own deployment).
- name: Build profiles lists
id: profiles
run: |
GUICEDEE_MODULES=""
if [ "${{ inputs.profileGuicedee }}" = "true" ]; then GUICEDEE_MODULES="${GUICEDEE_MODULES:+$GUICEDEE_MODULES,}guicedee"; fi
if [ "${{ inputs.profileServices }}" = "true" ]; then GUICEDEE_MODULES="${GUICEDEE_MODULES:+$GUICEDEE_MODULES,}services"; fi
if [ "${{ inputs.profileEntityassist }}" = "true" ]; then GUICEDEE_MODULES="${GUICEDEE_MODULES:+$GUICEDEE_MODULES,}entityassist"; fi
JWEBMP_MODULES=""
if [ "${{ inputs.profileJwebmp }}" = "true" ]; then JWEBMP_MODULES="jwebmp"; fi
ACTIVITYMASTER=""
if [ "${{ inputs.profileActivityMaster }}" = "true" ]; then ACTIVITYMASTER="activity-master"; fi
WEBSITES=""
if [ "${{ inputs.profileWebsites }}" = "true" ]; then WEBSITES="websites"; fi
echo "guicedee_modules=$GUICEDEE_MODULES" >> "$GITHUB_OUTPUT"
echo "jwebmp_modules=$JWEBMP_MODULES" >> "$GITHUB_OUTPUT"
echo "activitymaster=$ACTIVITYMASTER" >> "$GITHUB_OUTPUT"
echo "websites=$WEBSITES" >> "$GITHUB_OUTPUT"
echo "GuicedEE BOMs: ${{ inputs.deployGuicedeeBoms }}"
echo "GuicedEE modules: $GUICEDEE_MODULES"
echo "JWebMP BOMs: ${{ inputs.deployJwebmpBoms }}"
echo "JWebMP modules: $JWEBMP_MODULES"
echo "Activity Master: $ACTIVITYMASTER"
echo "Websites: $WEBSITES"
# ── Deploy Versioner BOM ─────────────────────────
# The Versioner BOM is the foundation for all other BOMs and must be deployed first.
- name: 'Maven: Deploy Versioner'
if: ${{ inputs.deployVersioner }}
run: >
mvn -B -ntp deploy
--file GuicedEE/bom/Versioner/pom.xml
-DskipTests
${{ inputs.centralRelease && '-Dcentral.publishing.skip=false -Dmaven.deploy.skip=true' || '' }}
-U
# ── Deploy GuicedEE BOMs ────────────────────────
# Each BOM must be deployed individually because the central-publishing plugin
# uses a shared staging directory in reactor builds, causing POM-only modules
# to lose their primary .pom artifact (only .asc and checksums survive).
- name: 'Maven: Deploy GuicedEE BOMs'
if: ${{ inputs.deployGuicedeeBoms }}
run: |
CENTRAL_FLAGS="${{ inputs.centralRelease && '-Dcentral.publishing.skip=false -Dmaven.deploy.skip=true' || '' }}"
BOM_POMS=(
GuicedEE/bom/StandaloneBOM/pom.xml
GuicedEE/bom/TestLayoutBOM/pom.xml
GuicedEE/bom/SwaggerBOM/pom.xml
GuicedEE/bom/JBossBOM/pom.xml
GuicedEE/bom/JakartaBOM/pom.xml
GuicedEE/bom/HibernateBOM/pom.xml
GuicedEE/bom/GoogleBOM/pom.xml
GuicedEE/bom/FasterXMLBOM/pom.xml
GuicedEE/bom/ApacheBOM/pom.xml
GuicedEE/bom/ApacheCXFBOM/pom.xml
GuicedEE/bom/SmallRyeBOM/pom.xml
GuicedEE/bom/pom.xml
GuicedEE/parent/pom.xml
)
for pom in "${BOM_POMS[@]}"; do
echo "──── Deploying $pom ────"
mvn -B -ntp deploy \
--file "$pom" \
-DskipTests $CENTRAL_FLAGS -U
done
# ── Deploy GuicedEE Modules ─────────────────────
- name: 'Maven: Deploy GuicedEE Modules'
if: ${{ steps.profiles.outputs.guicedee_modules != '' }}
run: >
mvn -B -ntp deploy
"-P${{ steps.profiles.outputs.guicedee_modules }}"
${{ inputs.skipTests && '-DskipTests' || '' }}
${{ inputs.centralRelease && '-Dcentral.publishing.skip=false -Dmaven.deploy.skip=true' || '' }}
-U
# ── Deploy JWebMP BOMs ──────────────────────────
- name: 'Maven: Deploy JWebMP BOMs'
if: ${{ inputs.deployJwebmpBoms }}
run: |
CENTRAL_FLAGS="${{ inputs.centralRelease && '-Dcentral.publishing.skip=false -Dmaven.deploy.skip=true' || '' }}"
BOM_POMS=(
JWebMP/bom/pom.xml
JWebMP/parent/pom.xml
)
for pom in "${BOM_POMS[@]}"; do
echo "──── Deploying $pom ────"
mvn -B -ntp deploy \
--file "$pom" \
-DskipTests $CENTRAL_FLAGS -U
done
# ── Deploy JWebMP Modules ───────────────────────
- name: 'Maven: Deploy JWebMP Modules'
if: ${{ steps.profiles.outputs.jwebmp_modules != '' }}
run: >
mvn -B -ntp deploy
"-P${{ steps.profiles.outputs.jwebmp_modules }}"
${{ inputs.skipTests && '-DskipTests' || '' }}
${{ inputs.centralRelease && '-Dcentral.publishing.skip=false -Dmaven.deploy.skip=true' || '' }}
-U
# ── Deploy Activity Master ──────────────────────
# Includes: bom + parent + modules (all in one namespace)
- name: 'Maven: Deploy Activity Master'
if: ${{ steps.profiles.outputs.activitymaster != '' }}
run: >
mvn -B -ntp deploy
"-P${{ steps.profiles.outputs.activitymaster }}"
${{ inputs.skipTests && '-DskipTests' || '' }}
${{ inputs.centralRelease && '-Dcentral.publishing.skip=false -Dmaven.deploy.skip=true' || '' }}
-U
# ── Deploy Websites ─────────────────────────────
- name: 'Maven: Deploy Websites'
if: ${{ steps.profiles.outputs.websites != '' }}
run: >
mvn -B -ntp deploy
"-P${{ steps.profiles.outputs.websites }}"
${{ inputs.skipTests && '-DskipTests' || '' }}
${{ inputs.centralRelease && '-Dcentral.publishing.skip=false -Dmaven.deploy.skip=true' || '' }}
-U