pyzebra/.gitlab-ci.yml
2024-09-05 11:11:40 +02:00

50 lines
1.1 KiB
YAML

stages:
- build-and-publish
- deploy
- cleanup
default:
before_script:
- source /opt/miniconda3/etc/profile.d/conda.sh
build-and-publish:
stage: build-and-publish
rules:
- if: $CI_COMMIT_TAG
script:
- conda config --add channels conda-forge
- conda config --set solver libmamba
- conda config --set anaconda_upload yes
- conda build --token $ANACONDA_TOKEN /opt/pyzebra/conda-recipe
deploy-test:
stage: deploy
environment: testing
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- cd /opt/pyzebra
- git pull origin main --tags
- conda activate test
- conda build ./conda-recipe
- conda install --use-local --only-deps pyzebra -y
- sudo systemctl restart pyzebra-test.service
deploy-prod:
stage: deploy
environment: production
needs: ["build-and-publish"]
rules:
- if: $CI_COMMIT_TAG
when: delayed
start_in: 1 minute
script:
- conda activate prod
- conda update pyzebra -y
- sudo systemctl restart pyzebra-prod.service
cleanup-job:
stage: cleanup
script:
- conda build purge-all