This page details the steps needed to automatise the publication to the ESCAPE OSSR.

You would need to follow these steps just once! After this, every time you create a new release of your project, it will be automatically uploaded and published to the OSSR.

Content / Summary

  1. Include a codemeta.json metadata file into the root directory of your project.
  2. Link your GitLab project with Zenodo.
  3. Let the GitLab Continuous Integration (CI) work for you !
  4. One-click-build-and-publish

OSSR-CI-diagram

1. Include a CodeMeta metadata file

Generate one with using the CodeMeta generator.

To allow GitLab communicate with Zenodo through their APIs, a personal access token must be created and included into the GitLab project (as a masked !! environment variable).

Please note that (to date) the token can be assigned only to a single Zenodo account.

To create the token:

  • Go to zenodo.org.
  • Click on Account –> Applications –> Personal access token –> New token and Select the desired Scopes.

This token will be passed later in the deployment stage of the ZenodoCI pipeline (the same that you should also include into your project to automatise the upload).

For not sharing publicly your personal token, you should create a masked environment variable in your GitLab repository. This way, the token could be used as a variable without revealing its value. To create an an environment variable:

  • Go to your GitLab project.
  • Click on Settings –> CI/CD –> Variables –> Add variable –> Fill the fields –> Mask your variable(s) !!

Please name your environment variables as follows (so that no changes should be done to the .gitlab-ci.yml file);

  • ZENODO_TOKEN or SANDBOX_ZENODO_TOKEN
  • ZENODO_PROJECT_ID or SANDBOX_ZENODO_PROJECT_ID

so that environment variable(s) should look like:

    $ eossr-upload --token $ZENODO_TOKEN --sandbox False --input-directory ./build 
    $ eossr-upload -t $SANDBOX_ZENODO_TOKEN -s True -i ./build -id $SANDBOX_ZENODO_PROJECT_ID

3. Into your .gitlab-ci.yml file

Add the following code snippet.

Important note. Please read the full documentation of the page !

  • The first time CI is run, remove -id $ZENODO_PROJECT_ID to create a new record.
  • After that, you need to create the CI variable $ZENODO_PROJECT_ID (or $SANDBOX_ZENODO_PROJECT_ID) using the newly created record ID.
  • If you don’t, the next release will create a new record instead of updating the existing one.

To recover and save the record ID;

  1. Go to https://zenodo.org/deposit (or https://sandbox.zenodo.org/deposit)
  2. Click into your just uploaded project
  3. From your browser search bar, just copy the number (your deposit id) that it is included in the https direction.
    • ex: https://zenodo.org/record/3884963 –> just copy 3884963.
  4. Save it as a new environment variable in your GitLab project.
    • Go to your GitLab project. Click on Settings –> CI/CD –> Variables –> Add variable –> KEY=ZENODO_DEPOSIT_ID or SANDBOX_ZENODO_PROJECT_ID and fill the value with the deposit id.

4. ‘One-click-build-and-publish’

  1. Go to your GitLab project.
  2. Click on Project overview –> Releases –> New release