Files
wehub-resource-sync a2578d7ff1
snapshot_release / snapshot_release (push) Has been cancelled
Documentation: build and deploy / deploy (push) Has been cancelled
langchain4j-github-bot.yml lint / langchain4j-github-bot.yml validation (push) Has been cancelled
Java CI / compile_and_unit_test (17) (push) Has been cancelled
Java CI / compile_and_unit_test (21) (push) Has been cancelled
Java CI / compile_and_unit_test (25) (push) Has been cancelled
Split Package Detection / check-split-packages (push) Has been cancelled
Java CI / integration_test (21) (push) Has been cancelled
Java CI / compliance (push) Has been cancelled
Java CI / spotless (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:38:45 +08:00

191 lines
7.8 KiB
YAML

name: release
on:
workflow_dispatch:
inputs:
stableVersion:
description: "Stable release version (e.g., 1.8.0)"
required: true
betaVersion:
description: "Beta release version (e.g., 1.8.0-beta15)"
required: true
branch:
description: "Branch to release from (e.g., 'main' for minor releases, 'release/x.y.z' for patch releases)"
required: false
default: "main"
startFrom:
description: "Phase to start from (use to resume after a failed release)"
required: false
default: "core-and-parent"
type: choice
options:
- core-and-parent
- in-process-embeddings
- rest-of-modules
- commit-and-tag
env:
STABLE_VERSION: ${{ github.event.inputs.stableVersion || github.event.client_payload.stableVersion }}
BETA_VERSION: ${{ github.event.inputs.betaVersion || github.event.client_payload.betaVersion }}
BRANCH: ${{ github.event.inputs.branch || github.event.client_payload.branch || 'main' }}
START_FROM: ${{ github.event.inputs.startFrom || github.event.client_payload.startFrom || 'core-and-parent' }}
permissions:
contents: write
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
ref: ${{ env.BRANCH }}
fetch-depth: 0
# PAT is required to push the version commit and release tag to a protected branch
token: ${{ secrets.GH_RELEASE_AUTOMATION }}
- name: Set up JDK 25
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: '25'
distribution: 'temurin'
cache: maven
server-id: central
server-username: MAVEN_CENTRAL_USERNAME
server-password: MAVEN_CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Show inputs
run: |
echo "Stable version: $STABLE_VERSION"
echo "Beta version: $BETA_VERSION"
echo "Branch to release from: $BRANCH"
echo "Start from phase: $START_FROM"
- name: Compute start phase number
id: phase
run: |
case "$START_FROM" in
core-and-parent) echo "num=1" >> "$GITHUB_OUTPUT" ;;
in-process-embeddings) echo "num=2" >> "$GITHUB_OUTPUT" ;;
rest-of-modules) echo "num=3" >> "$GITHUB_OUTPUT" ;;
commit-and-tag) echo "num=4" >> "$GITHUB_OUTPUT" ;;
*) echo "Unknown startFrom: $START_FROM" >&2; exit 1 ;;
esac
- name: Extract current stable SNAPSHOT version from POM property
id: extract-stable-snapshot-version
run: |
REVISION=$(mvn help:evaluate -Dexpression=langchain4j.stable.version -q -DforceStdout)
echo "stableVersionSnapshot=$REVISION" >> $GITHUB_OUTPUT
- name: Update stable versions
run: mvn versions:set -DnewVersion="$STABLE_VERSION" -DoldVersion=${{ steps.extract-stable-snapshot-version.outputs.stableVersionSnapshot }} -DgroupId=* -DartifactId=* -DgenerateBackupPoms=false
- name: Update stable version property
run: mvn versions:set-property -Dproperty=langchain4j.stable.version -DnewVersion="$STABLE_VERSION" -DgenerateBackupPoms=false
- name: Extract current beta SNAPSHOT version from POM property
id: extract-beta-snapshot-version
run: |
REVISION=$(mvn help:evaluate -Dexpression=langchain4j.beta.version -q -DforceStdout)
echo "betaVersionSnapshot=$REVISION" >> $GITHUB_OUTPUT
- name: Update beta versions
run: mvn versions:set -DnewVersion="$BETA_VERSION" -DoldVersion=${{ steps.extract-beta-snapshot-version.outputs.betaVersionSnapshot }} -DgroupId=* -DartifactId=* -DgenerateBackupPoms=false
- name: Update beta version property
run: mvn versions:set-property -Dproperty=langchain4j.beta.version -DnewVersion="$BETA_VERSION" -DgenerateBackupPoms=false
- name: Release core and parent modules
if: ${{ fromJSON(steps.phase.outputs.num) <= 1 }}
run: mvn -B -U -pl internal/langchain4j-internal-test-retry,langchain4j-core,langchain4j-parent -Psign clean deploy
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
- name: Release in-process embeddings modules
if: ${{ fromJSON(steps.phase.outputs.num) <= 2 }}
run: |
EMBEDDING_MODULES=$(find embeddings -mindepth 1 -maxdepth 1 -type d -exec test -f "{}/pom.xml" \; -print | paste -sd , -)
mvn -B -U --fail-at-end \
-DskipTests -DskipITs \
-pl "$EMBEDDING_MODULES" \
-Psign clean deploy
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
- name: Release the rest of the modules
if: ${{ fromJSON(steps.phase.outputs.num) <= 3 }}
run: |
EMBEDDING_MODULES=$(find embeddings -mindepth 1 -maxdepth 1 -type d -exec test -f "{}/pom.xml" \; -print | paste -sd , -)
EXCLUDES="!internal/langchain4j-internal-test-retry,!langchain4j-core,!langchain4j-parent"
# Append embeddings exclusions (converted to !path syntax)
if [ -n "$EMBEDDING_MODULES" ]; then
EMBEDDING_MODULES_EXCLUDES=$(echo "$EMBEDDING_MODULES" | sed 's/[^,]*/!\0/g')
EXCLUDES="$EXCLUDES,$EMBEDDING_MODULES_EXCLUDES"
fi
# Exclude integration-tests and all its submodules
INTEGRATION_TEST_MODULES=$(find integration-tests -mindepth 1 -maxdepth 2 -type d -exec test -f "{}/pom.xml" \; -print | paste -sd , -)
EXCLUDES="$EXCLUDES,!integration-tests"
if [ -n "$INTEGRATION_TEST_MODULES" ]; then
INTEGRATION_TEST_EXCLUDES=$(echo "$INTEGRATION_TEST_MODULES" | sed 's/[^,]*/!\0/g')
EXCLUDES="$EXCLUDES,$INTEGRATION_TEST_EXCLUDES"
fi
# Exclude internal modules
EXCLUDES="$EXCLUDES,!internal/langchain4j-docu-chatbot-updater"
echo "Excluding modules: $EXCLUDES"
mvn -B -U --fail-at-end \
-DskipTests -DskipITs \
-pl "$EXCLUDES" \
-Psign clean deploy
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
- name: Commit version changes
if: ${{ fromJSON(steps.phase.outputs.num) <= 4 }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add pom.xml '**/pom.xml'
git commit -m "Release versions $STABLE_VERSION and $BETA_VERSION"
- name: Push
if: ${{ fromJSON(steps.phase.outputs.num) <= 4 }}
run: |
git push origin "$BRANCH"
- name: Tag release
if: ${{ fromJSON(steps.phase.outputs.num) <= 4 }}
run: |
git tag "$STABLE_VERSION"
git push origin "$STABLE_VERSION"
- name: Trigger release in the langchain4j/langchain4j-spring repo
env:
GH_TOKEN: ${{ secrets.GH_RELEASE_AUTOMATION }}
run: |
gh api repos/langchain4j/langchain4j-spring/dispatches \
-f event_type=trigger-release \
-f "client_payload[stableVersion]=$STABLE_VERSION" \
-f "client_payload[betaVersion]=$BETA_VERSION" \
-f "client_payload[branch]=$BRANCH"