Files
oneuptime/ci/spec/python-sdk/deploy.yaml
2022-02-05 19:17:17 +00:00

69 lines
2.5 KiB
YAML

## DEPLOYMENT STAGE - PYTHON SDK
staging_python-sdk:
stage: Deploy
allow_failure: true
retry: 2
script:
- sudo apt-get update
- sudo apt --fix-broken install -y
- sudo apt-get install -y curl gcc
- sudo apt-get install -y build-essential
- curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
- sudo apt-get install -y python3-pip
- cd python-sdk
- pip3 install -r requirements.txt
# - git init
# - git add .
# - git commit -m "staging commit version 4.0.$CI_PIPELINE_ID"
- bumpversion --new-version 4.0.$CI_PIPELINE_ID patch setup.py
- python3 setup.py sdist bdist_wheel
- twine check dist/*
- twine upload --repository-url https://test.pypi.org/legacy/ dist/* -u=$PyPi_USERNAME -p=$PyPi_PASSWORD
- git init
- git add .
- git commit -m "staging commit version 4.0.$CI_PIPELINE_ID"
- git checkout staging || git checkout -b staging
- git push https://$GITHUB_USERNAME:$GITHUB_PASSWORD@github.com/OneUptime/python-sdk.git staging --force
- cd ..
- chmod +x ./ci/scripts/cleanup.sh
- ./ci/scripts/cleanup.sh
only:
refs:
- master
- hotfix-master
environment:
name: staging
## DEPLOYMENT STAGE - PYTHON SDK
production_python-sdk:
stage: Deploy
allow_failure: true
retry: 2
script:
- sudo apt-get update
- sudo apt --fix-broken install -y
- sudo apt-get install -y curl gcc
- sudo apt-get install -y build-essential
- curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
- sudo apt-get install -y python3-pip
- cd python-sdk
- pip3 install -r requirements.txt
- bumpversion --new-version 4.0.$CI_PIPELINE_ID patch setup.py
- python3 setup.py sdist bdist_wheel
- twine check dist/*
- twine upload dist/* -u=$PyPi_USERNAME -p=$PyPi_PASSWORD
- git init
- git add .
- git commit -m "production commit version 4.0.$CI_PIPELINE_ID" || echo "Nothing to update because no changes to sdk was made" && exit 0
- git checkout -f master
- git push https://$GITHUB_USERNAME:$GITHUB_PASSWORD@github.com/OneUptime/python-sdk.git master --force
- cd ..
- chmod +x ./ci/scripts/cleanup.sh
- ./ci/scripts/cleanup.sh
only:
refs:
- release
- hotfix-release
environment:
name: staging