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
92 lines
3.5 KiB
YAML
92 lines
3.5 KiB
YAML
name: "Documentation: update versions"
|
|
|
|
on:
|
|
repository_dispatch:
|
|
types: [ trigger-docs-update-version ]
|
|
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
|
|
|
|
env:
|
|
STABLE_VERSION: ${{ github.event.inputs.stableVersion || github.event.client_payload.stableVersion }}
|
|
BETA_VERSION: ${{ github.event.inputs.betaVersion || github.event.client_payload.betaVersion }}
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
update-docs:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
with:
|
|
token: ${{ secrets.GH_RELEASE_AUTOMATION }}
|
|
|
|
- name: Extract current stable and beta versions from docs metadata
|
|
id: extract-current-versions
|
|
run: |
|
|
STABLE_CURRENT=$(grep -E "^stableVersion:" docs/docs/get-started.md | sed 's/stableVersion: *//')
|
|
BETA_CURRENT=$(grep -E "^betaVersion:" docs/docs/get-started.md | sed 's/betaVersion: *//')
|
|
echo "stableCurrent=$STABLE_CURRENT" >> $GITHUB_OUTPUT
|
|
echo "betaCurrent=$BETA_CURRENT" >> $GITHUB_OUTPUT
|
|
echo "Found stable version in docs: $STABLE_CURRENT"
|
|
echo "Found beta version in docs: $BETA_CURRENT"
|
|
|
|
- name: Replace versions in docs recursively
|
|
run: |
|
|
echo "Replacing all occurrences of stable and beta versions recursively under docs/docs/..."
|
|
|
|
# Replace beta versions
|
|
grep -rl "${{ steps.extract-current-versions.outputs.betaCurrent }}" docs/docs | \
|
|
xargs sed -i "s/${{ steps.extract-current-versions.outputs.betaCurrent }}/$BETA_VERSION/g" || true
|
|
|
|
# Replace stable versions
|
|
grep -rl "${{ steps.extract-current-versions.outputs.stableCurrent }}" docs/docs | \
|
|
xargs sed -i "s/${{ steps.extract-current-versions.outputs.stableCurrent }}/$STABLE_VERSION/g" || true
|
|
|
|
- name: Update metadata in get-started.md
|
|
run: |
|
|
sed -i "s/betaVersion: .*/betaVersion: $BETA_VERSION/" docs/docs/get-started.md
|
|
sed -i "s/stableVersion: .*/stableVersion: $STABLE_VERSION/" docs/docs/get-started.md
|
|
|
|
- name: Check if any changes were made
|
|
id: git-check
|
|
run: |
|
|
if git diff --quiet; then
|
|
echo "changed=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "changed=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Commit and push changes
|
|
if: steps.git-check.outputs.changed == 'true'
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add docs/docs
|
|
git commit -m "docu: update versions to $STABLE_VERSION and $BETA_VERSION"
|
|
git push origin main
|
|
|
|
- name: Trigger documentation build and deploy
|
|
if: steps.git-check.outputs.changed == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh api repos/langchain4j/langchain4j/dispatches \
|
|
-f event_type=trigger-docs-build-and-deploy
|
|
|
|
- name: Trigger documentation chatbot update
|
|
if: steps.git-check.outputs.changed == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh api repos/langchain4j/langchain4j/dispatches \
|
|
-f event_type=trigger-docs-update-chatbot
|