Split build-and-publish job

[skip ci]
This commit is contained in:
usov_i 2024-09-05 14:57:02 +02:00
parent 19e934e873
commit 982887ab85

View File

@ -1,6 +1,7 @@
stages: stages:
- build-and-publish - build
- deploy - deploy
- publish
- cleanup - cleanup
default: default:
@ -11,33 +12,26 @@ workflow:
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
build-and-publish: build-job:
stage: build-and-publish stage: build
rules:
- if: $CI_COMMIT_TAG
script: script:
- conda config --add channels conda-forge - conda config --add channels conda-forge
- conda config --set solver libmamba - conda config --set solver libmamba
- conda config --set anaconda_upload yes - conda build --no-anaconda-upload ./conda-recipe
- conda build --token $ANACONDA_TOKEN /opt/pyzebra/conda-recipe
deploy-test: deploy-test-job:
stage: deploy stage: deploy
environment: testing environment: testing
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script: script:
- cd /opt/pyzebra - cd /opt/pyzebra
- git pull origin main --tags - git pull origin main --tags
- conda activate test - conda activate test
- conda build ./conda-recipe
- conda install --use-local --only-deps pyzebra -y - conda install --use-local --only-deps pyzebra -y
- sudo systemctl restart pyzebra-test.service - sudo systemctl restart pyzebra-test.service
deploy-prod: deploy-prod-job:
stage: deploy stage: deploy
environment: production environment: production
needs: ["build-and-publish"]
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
when: delayed when: delayed
@ -47,6 +41,13 @@ deploy-prod:
- conda update pyzebra -y - conda update pyzebra -y
- sudo systemctl restart pyzebra-prod.service - sudo systemctl restart pyzebra-prod.service
publish-job:
stage: publish
rules:
- if: $CI_COMMIT_TAG
script:
- anaconda --token $ANACONDA_TOKEN upload $(conda build ./conda-recipe --output)
cleanup-job: cleanup-job:
stage: cleanup stage: cleanup
script: script: