Skip to content
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
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'temurin'

- name: Build with Maven
run: mvn clean package
run: mvn -B clean package
24 changes: 19 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish to GitHub Packages
name: Publish

on:
push:
Expand All @@ -13,16 +13,30 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Build with Maven
run: mvn clean package
run: mvn -B clean package

- name: Publish to GitHub Packages
run: mvn deploy
- name: Publish to Maven Central
run: mvn -B deploy -P central
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,15 @@ Check out our [Spring AI Example](https://langfuse.com/docs/integrations/spring-

## Installation

Add the langfuse-java API client as a dependency using
The recommended way to install the langfuse-java API client is via Maven Central:

```xml
<dependency>
<groupId>com.langfuse</groupId>
<artifactId>langfuse-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.4</version>
</dependency>
```
to fetch our [GitHub package](https://github.com/langfuse/langfuse-java/packages/2423464).

If you're not scanning the GitHub Package Registry by default, you'll have to add
```xml
<repositories>
<repository>
<id>github</id>
<name>GitHub Package Registry</name>
<url>https://maven.pkg.github.com/langfuse/langfuse-java</url>
</repository>
</repositories>
```
as well.

## Usage

Expand Down Expand Up @@ -65,6 +53,16 @@ try {
Run `./mvnw release:prepare -DreleaseVersion=` with the version you want to create.
Push the changes including the tag.

## Publishing to Maven Central

This project is configured to publish to Maven Central.
To publish to Maven Central, you need to configure the following secrets in your GitHub repository:

- `OSSRH_USERNAME`: Your Sonatype OSSRH username
- `OSSRH_PASSWORD`: Your Sonatype OSSRH password
- `GPG_PRIVATE_KEY`: Your GPG private key for signing artifacts
- `GPG_PASSPHRASE`: The passphrase for your GPG private key

## Updating

1. Ensure that langfuse-java is placed in the same directory as the main [langfuse](https://github.com/langfuse/langfuse) repository.
Expand Down
108 changes: 99 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,32 @@
<packaging>jar</packaging>

<name>langfuse-java</name>
<description>Java client for the Langfuse API</description>
<url>https://langfuse.com</url>

<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>Langfuse Team</name>
<email>[email protected]</email>
<organization>Langfuse</organization>
<organizationUrl>https://langfuse.com</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:https://github.com/langfuse/langfuse-java.git</connection>
<tag>HEAD</tag>
</scm>
<developerConnection>scm:git:https://github.com/langfuse/langfuse-java.git</developerConnection>
<url>https://github.com/langfuse/langfuse-java</url>
<tag>HEAD</tag>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -21,13 +41,83 @@
<junit.version>5.9.3</junit.version>
</properties>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/langfuse/langfuse-java</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>central</id>
<build>
<plugins>
<!-- GPG Signing -->
<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>
<!-- Prevent gpg from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>

<!-- Central Publishing Plugin -->
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.7.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<!-- Source JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Javadoc JAR -->
<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>
</plugins>
</build>

<dependencies>
<!-- Jackson dependencies -->
Expand Down