feat: Update release workflow for Maven Central deployment and enhance POM metadata
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
86
.github/workflows/maven-publish.yml
vendored
86
.github/workflows/maven-publish.yml
vendored
@@ -1,22 +1,25 @@
|
||||
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
|
||||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
|
||||
# This workflow derives the next release version from the repository, tags it,
|
||||
# updates the published release, and deploys the artifact to Maven Central.
|
||||
|
||||
name: Maven Package
|
||||
name: Release To Maven Central
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
publish:
|
||||
if: ${{ !github.event.release.prerelease }}
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.repository.default_branch }}
|
||||
- name: Set up JDK 25
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
@@ -27,12 +30,71 @@ jobs:
|
||||
server-password: MAVEN_PASSWORD
|
||||
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
|
||||
gpg-passphrase: MAVEN_GPG_PASSPHRASE
|
||||
- name: Set version
|
||||
run: mvn versions:set -DnewVersion=${{ github.event.release.tag_name }}
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
- name: Calculate release version
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
current_version="$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version | tail -n 1 | tr -d '\r')"
|
||||
base_version="${current_version%-SNAPSHOT}"
|
||||
|
||||
if [[ ! "$base_version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
||||
echo "Unsupported project version format: $current_version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
major="${BASH_REMATCH[1]}"
|
||||
minor="${BASH_REMATCH[2]}"
|
||||
release_version="${major}.$((minor + 1)).0"
|
||||
|
||||
echo "current_version=$current_version" >> "$GITHUB_OUTPUT"
|
||||
echo "release_version=$release_version" >> "$GITHUB_OUTPUT"
|
||||
echo "release_tag=$release_version" >> "$GITHUB_OUTPUT"
|
||||
- name: Update release files
|
||||
env:
|
||||
RELEASE_VERSION: ${{ steps.version.outputs.release_version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
mvn -B versions:set -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false
|
||||
perl -0pi -e 's{<version>\d+\.\d+\.\d+</version>}{<version>'"$RELEASE_VERSION"'</version>}g' README.md
|
||||
- name: Commit release version
|
||||
env:
|
||||
RELEASE_VERSION: ${{ steps.version.outputs.release_version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
git add pom.xml README.md
|
||||
git commit -m "chore: release $RELEASE_VERSION"
|
||||
git push origin HEAD:${{ github.event.repository.default_branch }}
|
||||
- name: Create release tag
|
||||
env:
|
||||
RELEASE_TAG: ${{ steps.version.outputs.release_tag }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
git tag "$RELEASE_TAG"
|
||||
git push origin "$RELEASE_TAG"
|
||||
- name: Retarget GitHub release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_ID: ${{ github.event.release.id }}
|
||||
RELEASE_TAG: ${{ steps.version.outputs.release_tag }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
gh api "repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" \
|
||||
--method PATCH \
|
||||
-f tag_name="$RELEASE_TAG" \
|
||||
-f target_commitish="${{ github.event.repository.default_branch }}" \
|
||||
-f name="$RELEASE_TAG"
|
||||
- name: Publish package
|
||||
run: mvn -P release --batch-mode deploy -DskipTests
|
||||
run: mvn -B -P release deploy -DskipTests
|
||||
env:
|
||||
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
|
||||
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
|
||||
|
||||
16
README.md
16
README.md
@@ -41,25 +41,13 @@ The current built-in client set supports both chat completions and legacy text c
|
||||
|
||||
## Setup
|
||||
|
||||
The published artifacts are hosted in the external Maven repository, so consuming applications must add that repository in addition to Maven Central:
|
||||
The published artifacts are hosted on Maven Central, so no additional repository configuration is required:
|
||||
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spacecraft-tactics-releases</id>
|
||||
<name>Spacecraft Tactics Repository</name>
|
||||
<url>https://spacecraft-tactics.com/repository/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Central</id>
|
||||
<url>https://repo1.maven.org/maven2/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.extio</groupId>
|
||||
<artifactId>lm-lib</artifactId>
|
||||
<version>${lmlib.version}</version>
|
||||
<version>2.5.13</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
26
pom.xml
26
pom.xml
@@ -4,7 +4,33 @@
|
||||
<artifactId>lm-lib</artifactId>
|
||||
<groupId>de.extio</groupId>
|
||||
<name>lm-lib</name>
|
||||
<description>Modular Java library for LLM-powered applications, model clients, and agentic orchestration.</description>
|
||||
<url>https://github.com/extio-de/lm-lib</url>
|
||||
<version>2.5.13</version>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License, Version 2.0</name>
|
||||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>extio</id>
|
||||
<name>extio</name>
|
||||
<organization>extio</organization>
|
||||
<organizationUrl>https://github.com/extio-de</organizationUrl>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git://github.com/extio-de/lm-lib.git</connection>
|
||||
<developerConnection>scm:git:ssh://git@github.com/extio-de/lm-lib.git</developerConnection>
|
||||
<url>https://github.com/extio-de/lm-lib</url>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<java.version>25</java.version>
|
||||
|
||||
Reference in New Issue
Block a user