60 lines
1.3 KiB
YAML
60 lines
1.3 KiB
YAML
stages:
|
|
- build
|
|
- deploy
|
|
- publish
|
|
- cleanup
|
|
|
|
workflow:
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|
|
variables:
|
|
BUILD_PATH: /home/pyzebra/build-prod
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
variables:
|
|
BUILD_PATH: /home/pyzebra/build-test
|
|
|
|
default:
|
|
before_script:
|
|
- source /opt/miniconda3/etc/profile.d/conda.sh
|
|
|
|
build-job:
|
|
stage: build
|
|
script:
|
|
- conda config --add channels conda-forge
|
|
- conda config --set solver libmamba
|
|
- conda build --no-anaconda-upload --output-folder $BUILD_PATH ./conda-recipe
|
|
|
|
deploy-test-job:
|
|
stage: deploy
|
|
environment: testing
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
script:
|
|
- conda activate test
|
|
- conda install --channel $BUILD_PATH --force-reinstall pyzebra -y
|
|
- sudo systemctl restart pyzebra-test.service
|
|
|
|
deploy-prod-job:
|
|
stage: deploy
|
|
environment: production
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|
|
script:
|
|
- conda activate prod
|
|
- conda install --channel $BUILD_PATH pyzebra -y
|
|
- sudo systemctl restart pyzebra-prod.service
|
|
|
|
publish-job:
|
|
stage: publish
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|
|
script:
|
|
- conda activate base
|
|
- anaconda --token $ANACONDA_TOKEN upload $(conda build --output-folder $BUILD_PATH ./conda-recipe --output)
|
|
|
|
cleanup-job:
|
|
stage: cleanup
|
|
script:
|
|
- rm -rf $BUILD_PATH
|
|
- conda build purge-all
|