fixing bugs with ci pipeline

This commit is contained in:
GotthardG 2024-12-16 13:01:08 +01:00
parent 98a2cbfae5
commit f9deee391b
2 changed files with 8 additions and 10 deletions

View File

@ -57,8 +57,10 @@ release:
when: manual when: manual
variables: variables:
TWINE_USERNAME: gitlab-ci-token # Keep username same TWINE_USERNAME: gitlab-ci-token # Keep username 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:
- pip install build twine # Install dependencies - cd backend/python-client # Navigate to the folder where the package was generated
- python -m build # Build the package - python3 -m venv .venv
- source .venv/bin/activate
- pip install -U pip twine
- twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* - twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*

View File

@ -34,12 +34,8 @@ fi
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 twine build pip install -U pip build
python -m build python -m build
# Upload package (only if in CI environment) # Skip uploading the package. This will happen in the release stage.
if [[ -z "${CI_API_V4_URL}" || -z "${CI_PROJECT_ID}" ]]; then echo "Python client generated and package built successfully."
echo "Skipping package upload—CI variables not set."
else
twine upload --repository-url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi" dist/*
fi