From d3954dbb6fce74a3fedb75e6e3e5c8fbf99ede62 Mon Sep 17 00:00:00 2001 From: Javier Martinez Date: Tue, 2 Jun 2026 19:52:00 +0200 Subject: [PATCH] chore: update post update release (#2235) * chore: fix uv lock after update (cherry picked from commit 29137d673ec4112ea6a665413c15369b5e3f6f08) * chore(docs): fix postupdate (cherry picked from commit 3a6fb0179a1183ed60b8ca28bdff248aa1358df4) * chore(docs): use node 24 (cherry picked from commit 3c30538a32914e529e1565740916b3032727cd47) * chore(build): copy version.txt (cherry picked from commit bb1ea2f1d64e44f873424306fdc062e1449a65b3) --- .github/workflows/fern-check.yml | 5 ++++ .github/workflows/post-release-please.yml | 30 ++++++++++++++++++++++- .github/workflows/preview-docs.yml | 2 +- .github/workflows/publish-docs.yml | 6 +++-- private_gpt/utils/runner.py | 19 +++++++++----- pyproject.toml | 1 + 6 files changed, 53 insertions(+), 10 deletions(-) diff --git a/.github/workflows/fern-check.yml b/.github/workflows/fern-check.yml index 6b021abc..c04be453 100644 --- a/.github/workflows/fern-check.yml +++ b/.github/workflows/fern-check.yml @@ -14,6 +14,11 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "24" + - name: Install Fern run: npm install -g fern-api diff --git a/.github/workflows/post-release-please.yml b/.github/workflows/post-release-please.yml index 17637f60..edb39fd3 100644 --- a/.github/workflows/post-release-please.yml +++ b/.github/workflows/post-release-please.yml @@ -36,6 +36,34 @@ jobs: run: | git config user.email "ci@zylon.ai" git config user.name "Zylon CI" - git add docs/openapi/openapi.json + git add fern/openapi/openapi.json git diff --staged --quiet || git commit -m "docs: update OpenAPI spec for ${{ steps.update-openapi.outputs.version }}" git push + + update-uv-lock: + runs-on: ubuntu-latest + if: github.head_ref == 'release-please--branches--main' || github.ref_name == 'release-please--branches--main' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref || github.ref_name }} + token: ${{ secrets.PAT || github.token }} + + - name: Install dependencies + uses: ./.github/workflows/actions/install_dependencies + + - name: Refresh uv.lock + id: update-uv-lock + run: | + version=$(cat version.txt) + uv lock + echo "version=$version" >> "$GITHUB_OUTPUT" + + - name: Commit and push changes + run: | + git config user.email "ci@zylon.ai" + git config user.name "Zylon CI" + git add uv.lock + git diff --staged --quiet || git commit -m "build: update uv.lock for ${{ steps.update-uv-lock.outputs.version }}" + git push diff --git a/.github/workflows/preview-docs.yml b/.github/workflows/preview-docs.yml index eec2f22e..79c1070e 100644 --- a/.github/workflows/preview-docs.yml +++ b/.github/workflows/preview-docs.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "22" + node-version: "24" - name: Install Fern run: npm install -g fern-api diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index a7ff1e35..be524f0e 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -14,8 +14,10 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Setup node - uses: actions/setup-node@v3 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "24" - name: Download Fern run: npm install -g fern-api diff --git a/private_gpt/utils/runner.py b/private_gpt/utils/runner.py index 0d2a1820..50c45559 100644 --- a/private_gpt/utils/runner.py +++ b/private_gpt/utils/runner.py @@ -1,8 +1,15 @@ +from __future__ import annotations + +from importlib.metadata import PackageNotFoundError, version +from pathlib import Path + + def get_version() -> str: - with open("version.txt", "r+") as version_file: + try: + return version("private-gpt") + except PackageNotFoundError: + version_file = Path(__file__).resolve().parents[2] / "version.txt" try: - release_version = version_file.read() - version_file.close() - return release_version - except OSError as e: - raise ImportError("Version file not found") from e + return version_file.read_text(encoding="utf-8").strip() + except OSError as exc: + raise ImportError("Version metadata not found") from exc diff --git a/pyproject.toml b/pyproject.toml index 7fc6616f..70dcb247 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -348,6 +348,7 @@ packages = ["private_gpt"] [tool.hatch.build.targets.wheel.force-include] "settings.yaml" = "settings.yaml" +"version.txt" = "version.txt" "ui" = "ui" "scripts" = "scripts"