Skip to content
Open
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
46 changes: 46 additions & 0 deletions .github/workflows/publish-central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish to Maven Central

on:
workflow_dispatch:
inputs:
auto_publish:
description: Publish automatically after validation
type: boolean
default: false

permissions:
contents: read

concurrency:
group: maven-central
cancel-in-progress: false

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
cache: maven
server-id: central
server-username: CENTRAL_USERNAME
server-password: CENTRAL_TOKEN

- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
run: echo "$GPG_PRIVATE_KEY" | gpg --batch --import

- name: Publish library and shaded artifact
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
run: |
mvn -B -Prelease -Dcentral.autoPublish=${{ inputs.auto_publish }} deploy
mvn -B -Prelease -Dcentral.autoPublish=${{ inputs.auto_publish }} -f shaded/pom.xml deploy
27 changes: 0 additions & 27 deletions .github/workflows/publish-shaded.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Publish
run: mvn -B deploy
run: mvn -B -Pgithub-packages deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ custom parser configurations must use the new classes.

Added a shaded openid4java-shaded 2.0.0 artifact for Jenkins plugins,
with Guice, Guava, HttpClient 5, jsoup and the injection APIs relocated
under org.openid4java.shaded.*.
under org.openid4java.shaded.*. The library and the shaded artifact are
published to Maven Central.

Upgraded the test-only JDOM dependency from 1.0 to JDOM 2.

Expand Down
29 changes: 6 additions & 23 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,12 @@ Using the library:
<version>2.0.0</version>
</dependency>

The Amarula Solutions fork is published to GitHub Packages. Add the
repository to your project:

<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/amarula/openid4java</url>
</repository>
</repositories>

GitHub Packages requires authentication. Add a server entry to
~/.m2/settings.xml with your GitHub username and a personal access
token that has the read:packages scope:

<servers>
<server>
<id>github</id>
<username>YOUR_GITHUB_USERNAME</username>
<password>YOUR_PAT</password>
</server>
</servers>

The core dependencies are resolved transitively by Maven.
The Amarula Solutions fork is published to Maven Central. No
additional repository or authentication configuration is required;
the core dependencies are resolved transitively by Maven.

Internal builds may instead publish the library to GitHub Packages
using the github-packages Maven profile.

For Jenkins plugins, use the shaded artifact:

Expand Down
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ The following specifications are supported:
</dependency>
```

Artifacts are published to GitHub Packages. See [INSTALL](INSTALL) for
the repository and authentication setup.
Artifacts are published to Maven Central and can be resolved without
additional repository or authentication configuration.

# Jenkins shaded artifact #

Expand All @@ -50,8 +50,21 @@ relocated third-party dependencies:
Guice, Guava, HttpClient 5, jsoup and the injection APIs are relocated
under `org.openid4java.shaded.*`. `commons-codec` remains an external
dependency and `slf4j-api` is provided by the runtime (Jenkins provides
it). The shaded artifact is published to GitHub Packages; see
[INSTALL](INSTALL).
it). The shaded artifact is published to Maven Central alongside the
library; no repository configuration is required.

# Publishing #

The `Publish to Maven Central` workflow publishes the library and the
shaded artifact through the Sonatype Central Portal. It requires these
repository secrets:

* `CENTRAL_USERNAME` and `CENTRAL_TOKEN`: a Central Portal user token
* `GPG_PRIVATE_KEY` and `GPG_PASSPHRASE`: the signing key

The workflow defaults to `auto_publish=false`, which validates both
deployments and waits for a manual release in the Central Portal. Set
the `auto_publish` input to publish immediately.

# What is OpenID? #

Expand Down
34 changes: 25 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -605,23 +605,28 @@
<tag>HEAD</tag>
<url>https://github.com/amarula/openid4java</url>
</scm>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/amarula/openid4java</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>github-packages</id>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/amarula/openid4java</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>release</id>
<properties>
<central.autoPublish>false</central.autoPublish>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -632,6 +637,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.12.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>${central.autoPublish}</autoPublish>
<waitUntil>validated</waitUntil>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down
113 changes: 98 additions & 15 deletions shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,31 @@
</license>
</licenses>

<developers>
<developer>
<id>mtrimarchi</id>
<name>Michael Trimarchi</name>
<email>michael@amarulasolutions.com</email>
<organization>Amarula Solutions</organization>
<roles>
<role>maintainer</role>
</roles>
</developer>
</developers>

<scm>
<connection>scm:git:https://github.com/amarula/openid4java.git</connection>
<developerConnection>scm:git:ssh://git@github.com/amarula/openid4java.git</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/amarula/openid4java</url>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<openid4java.version>2.0.0</openid4java.version>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<repositories>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/amarula/openid4java</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.amarulasolutions</groupId>
Expand Down Expand Up @@ -64,6 +76,47 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.2</version>
<configuration>
<release>17</release>
<doclint>none</doclint>
<show>package</show>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down Expand Up @@ -127,11 +180,41 @@
</plugins>
</build>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/amarula/openid4java</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>release</id>
<properties>
<central.autoPublish>false</central.autoPublish>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.8</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.12.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>${central.autoPublish}</autoPublish>
<waitUntil>validated</waitUntil>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.openid4java.shaded;

/**
* Marker describing the relocated third-party dependencies of the shaded
* OpenID4Java artifact.
*
* <p>The shaded JAR relocates Guice, Guava, HttpClient 5, jsoup,
* {@code jakarta.inject} and {@code org.aopalliance} under
* {@code org.openid4java.shaded.*}, so they cannot conflict with the
* versions provided by the host application.</p>
*/
final class ShadedDependencies {

private ShadedDependencies() {
}
}
4 changes: 4 additions & 0 deletions shaded/src/main/java/org/openid4java/shaded/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Relocated third-party dependencies used by the OpenID4Java shaded artifact.
*/
package org.openid4java.shaded;
Loading