There is a newer version of the record available.

Published October 26, 2023 | Version 0.0.7
Software Open

deploy2zenodo

  • 1. Deutsches Zentrum für Luft- und Raumfahrt e. V.

Description

deploy2zenodo

deploy2zenodo is a script to deploy your data to zenodo. You can use it in a CI pipeline.

script parameter

Instead of command line parameters we use environment variables.

You have to provide the following variables:

variable content DEPLOY2ZENODO_API_URL The URL of the api to use. DEPLOY2ZENODO_ACCESS_TOKEN access token of zenodo DEPLOY2ZENODO_DEPOSITION_ID id of the deposition/record on zenodo DEPLOY2ZENODO_JSON file name with metadata in JSON format to upload DEPLOY2ZENODO_UPLOAD file name to upload

DEPLOY2ZENODO_API_URL

You can use the api of your own zenodo instance or you can use the official Zenodo instance:

state URL production https://zenodo.org/api testing https://sandbox.zenodo.org/api

DEPLOY2ZENODO_ACCESS_TOKEN

To access your zenodo account you have to provide an access token.

DEPLOY2ZENODO_DEPOSITION_ID

To update an existing record you have to provide the id of this record.

If you want to create a new record please set DEPLOY2ZENODO_DEPOSITION_ID to create NEW record, e. g. DEPLOY2ZENODO_DEPOSITION_ID="create NEW record". After creating this record read the script output and adapt DEPLOY2ZENODO_DEPOSITION_ID for the next run with the returned record id.

DEPLOY2ZENODO_JSON

The given file should contain the metadata in JSON format.

You can write this file on your own, e. g.:

{
  "metadata": {
    "title": "foo",
    "upload_type": "software",
    "creators": [
      {
        "name": "ich",
        "affiliation": "bar"
      }
    ],
    "description": "foos description"
  }
}

Or cffconvert can help you to create the necessary metadata in JSON format from a CITATION.cff file. Unfortunately we need jq to correct the format, e. g.:

cffconvert -i CITATION.cff -f zenodo | \
  jq -c '{"metadata": .}' | jq '.metadata += {"upload_type": "software"}' | \
  tee CITATION.json

DEPLOY2ZENODO_UPLOAD

The given file will be uploaded as data. Typically this would be an archive.

For example you can create an archive of a tag from a git repository:

TAG=0.0.3
git archive --format zip --output $TAG.zip $TAG

CI pipeline

Using the keyword include it is possible to include YAML files and/or CI pipelines in your GitLab CI pipeline. In this way you can use a template of deploy2zenodo for your CI pipeline.

You can use the latest version deploy2zenodo.yaml in your CI pipeline. Or you can use any special versions, e. g. deploy2zenodo.yaml v0.0.2.

A simple example choosing the stage to run could be:

include:
  - remote: 'https://gitlab.com/daniel_mohr/deploy2zenodo/-/releases/permalink/latest/downloads/deploy2zenodo.yaml'

deploy2zenodo:
  stage: deploy

The provided GitLab ci template of deploy2zenodo uses alpine:latest and installs necessary software in before_script. To use other images you must adapt it, e. g.:

include:
  - remote: 'https://gitlab.com/daniel_mohr/deploy2zenodo/-/releases/permalink/latest/downloads/deploy2zenodo.yaml'

deploy2zenodo:
  image:
    name: almalinux:latest
  before_script:
    - echo "nothing to do"

license: Apache-2.0

deploy2zenodo has the license Apache-2.0.

Copyright 2023 Daniel Mohr and
   Deutsches Zentrum fuer Luft- und Raumfahrt e. V., D-51170 Koeln

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Files

deploy2zenodo_v0.0.7.zip

Files (265.7 kB)

Name Size Download all
md5:7a4c2c0efbad50f9322547b8d3a8dc8a
1.2 kB Download
md5:1dfe0d75dc394a24a55dfad48b20d5ca
5.9 kB Download
md5:34732768b7cf4976f98b2daa308acbc1
6.8 kB Download
md5:67c24c01afa1f18866233a79ce4894b8
10.6 kB Preview Download
md5:2233cc3db31c8511026dded6070e4bfd
241.3 kB Preview Download

Additional details

Related works