stages: - test - deploy - test&deploy test_install: stage: test image: python:3.6.11-buster script: - apt-get -y update - pip install . only: - branches deploy_zenodo: stage: deploy image: python:3.6.11-buster #dependencies: ### Ideally to be used within a ci pipeline in where a container of the source code is build in a previous stage. ### You can have a look into https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/blob/master/.gitlab-ci.yml # - build_image before_script: ### 1 - Install dependencies in the image and upload the files to Zenodo - apt-get -y update ### INFORMATION FOR THE USER; Python, pip and wget are already installed in the container #- cat /etc/os-release # Debian GNU/Linux 10 (buster) #- pip3 --version # pip 20.1.1 #- python3 --version # 3.6.11 as expected - pip install requests numpy - pip install . # Install ZenodoCI ### 2 - Test the communication to Zenodo - Uncomment if needed, or if already done it manually. - test_connection_zenodo --token $SANDBOX_ZENODO_TOKEN --sandbox True -r $CI_PROJECT_DIR #- test_connection_zenodo -t $ZENODO_TOKEN -s False --repo_dir $CI_PROJECT_DIR script: ### 3 - Get the last tag/release of the repository - export REPOSITORY_NAME=zenodoci - export REPOSITORY_BASE_URL=https://gitlab.in2p3.fr/escape2020/wp3/$REPOSITORY_NAME ### 4 - Download the repository and move it to the build directory ### If no release is found/correctly parsed, the script will download the last commit pushed to the master branch - mkdir -p build - /bin/bash zenodoci/parse_last_release.sh $REPOSITORY_NAME $REPOSITORY_BASE_URL - ls ./build ### 5 - To deploy a NEW DEPOSIT to ZENODO SANDBOX - > upload_new_deposit --token $SANDBOX_ZENODO_TOKEN --sandbox True --input-directory ./build ### 5 - To deploy a NEW DEPOSIT to ZENODO #- > # upload_new_deposit # --token $ZENODO_TOKEN # --sandbox False # --input-directory ./build ### 5 - To deploy a NEW VERSION to ZENODO: The deposit_id of the entry to be `new_versioned` MUST be provided. - > upload_new_version_deposit --token $SANDBOX_ZENODO_TOKEN --sandbox True --input-directory ./build --deposit_id $DEPOSIT_ID_ZENODOCI # --token $ZENODO_TOKEN # --sandbox False only: ### Ideally this stage should be run only when a new release / tag of the source code is created, i.e., (- tags). # The script is changed to check that the both `upload_new_deposit` and `upload_new_version_deposit` works nicely. - tags - branches # For testing test_deploy_from_container: stage: test&deploy image: gitlab-registry.in2p3.fr/escape2020/wp3/zenodoci script: - pwd - ls - env - upload_new_deposit -h - codemeta2zenodo -h only: - tags - branches # testing