Sync project metadata with pyproject.toml
Updated scripts and backend to dynamically retrieve project name and version from `pyproject.toml`. This ensures consistent metadata across the OpenAPI client generation and the FastAPI application.
This commit is contained in:
@@ -60,15 +60,12 @@ release:
|
|||||||
stage: release
|
stage: release
|
||||||
when: manual
|
when: manual
|
||||||
variables:
|
variables:
|
||||||
TWINE_USERNAME: gitlab-ci-token # Keep username same
|
TWINE_USERNAME: gitlab-ci-token # Keep username the same
|
||||||
TWINE_PASSWORD: $CI_JOB_TOKEN # Use PAT stored in GitLab CI/CD Variables
|
TWINE_PASSWORD: $CI_JOB_TOKEN # Use PAT stored in GitLab CI/CD Variables
|
||||||
script:
|
script:
|
||||||
- echo "Setting up Python dependencies..."
|
- echo "Setting up Python dependencies..."
|
||||||
- source $VIRTUAL_ENV/bin/activate
|
- source $VIRTUAL_ENV/bin/activate
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
- bash make_openapi_client.sh
|
- bash make_openapi_client.sh # Generate OpenAPI client and package
|
||||||
- cd backend/python-client # Navigate to the folder where the package was generated
|
- ls backend/python-client/dist/ # Debug artifacts to ensure files exist
|
||||||
- python -m venv .venv
|
- twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi backend/python-client/dist/*
|
||||||
- source .venv/bin/activate
|
|
||||||
- pip install -U pip twine
|
|
||||||
- twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
|
|
||||||
@@ -44,11 +44,17 @@ if [[ ! -d python-client ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Build Python package
|
# Build Python package
|
||||||
|
echo "Building Python package..."
|
||||||
cd python-client || exit
|
cd python-client || exit
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pip install -U pip build
|
pip install -U pip build
|
||||||
python -m build
|
python -m build
|
||||||
|
|
||||||
# Skip uploading the package. This will happen in the release stage.
|
# Verify build output
|
||||||
echo "Python client generated and package built successfully."
|
if [[ ! -d dist || -z "$(ls -A dist)" ]]; then
|
||||||
|
echo "Error: No files generated in 'dist/'. Package build failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Python package built successfully in 'dist/'."
|
||||||
Reference in New Issue
Block a user