Commit 414e09c3 authored by Enrique Garcia's avatar Enrique Garcia
Browse files

Merge branch 'first_release' into 'master'

First release

See merge request escape2020/escape/zenodoci!1
parents 209a062a 72f06d84
Pipeline #78662 passed with stage
in 1 minute and 9 seconds
...@@ -19,7 +19,9 @@ deploy_zenodo: ...@@ -19,7 +19,9 @@ deploy_zenodo:
- pip3 install requests - pip3 install requests
### 2 - Get the last tag/release of the repository ### 2 - Get the last tag/release of the repository
- export REPOSITORY_NAME=template_project_escape
- export REPOSITORY_NAME=zenodoci
- export REPOSITORY_URL=https://gitlab.in2p3.fr/escape2020/escape/$REPOSITORY_NAME.git - export REPOSITORY_URL=https://gitlab.in2p3.fr/escape2020/escape/$REPOSITORY_NAME.git
- export LAST_RELEASE=`git ls-remote --tags --refs --sort="v:refname" $REPOSITORY_URL | tail -n1 | sed 's/.*\///'` - export LAST_RELEASE=`git ls-remote --tags --refs --sort="v:refname" $REPOSITORY_URL | tail -n1 | sed 's/.*\///'`
...@@ -28,14 +30,13 @@ deploy_zenodo: ...@@ -28,14 +30,13 @@ deploy_zenodo:
- mkdir -p build - mkdir -p build
- > - >
if [ -z "$LAST_RELEASE" ] if [ -z "$LAST_RELEASE" ]; then
then echo "No tag / new release found ! - Or error when parsing. Downloading last commit to the repository (master branch) ;"; \
echo "No tag / new release found ! - Or error when parsing. Downloading last commit to the repository (master branch) ;" wget -O $REPOSITORY_NAME-master.zip https://gitlab.in2p3.fr/escape2020/escape/"$REPOSITORY_NAME"/-/archive/master/"$REPOSITORY_NAME"-master.zip; \
wget -O $REPOSITORY_NAME-master.zip https://gitlab.in2p3.fr/escape2020/escape/"$REPOSITORY_NAME"/-/archive/master/"$REPOSITORY_NAME"-master.zip
mv $REPOSITORY_NAME-master.zip ./build mv $REPOSITORY_NAME-master.zip ./build
else else
echo "$LAST_RELEASE tag / release found !" echo "$LAST_RELEASE tag / release found !"; \
wget -O $REPOSITORY_NAME-$LAST_RELEASE.zip https://gitlab.in2p3.fr/escape2020/escape/"$REPOSITORY_NAME"/-/archive/"$LAST_RELEASE"/"$REPOSITORY_NAME"-"$LAST_RELEASE".zip wget -O $REPOSITORY_NAME-$LAST_RELEASE.zip https://gitlab.in2p3.fr/escape2020/escape/"$REPOSITORY_NAME"/-/archive/"$LAST_RELEASE"/"$REPOSITORY_NAME"-"$LAST_RELEASE".zip; \
mv $REPOSITORY_NAME-$LAST_RELEASE.zip ./build mv $REPOSITORY_NAME-$LAST_RELEASE.zip ./build
fi fi
...@@ -68,4 +69,4 @@ deploy_zenodo: ...@@ -68,4 +69,4 @@ deploy_zenodo:
### Ideally this stage should be run only when a new release / tag of the source code is created (- tags). ### Ideally this stage should be run only when a new release / tag of the source code is created (- tags).
# The script is changed to check that the both `upload_new_deposit` and `upload_new_version_deposit` works nicely. # The script is changed to check that the both `upload_new_deposit` and `upload_new_version_deposit` works nicely.
- tags - tags
- master - branches
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,7 @@ import os ...@@ -3,7 +3,7 @@ import os
import json import json
import argparse import argparse
from distutils.util import strtobool from distutils.util import strtobool
from .zenodoapi import ZenodoAPI from zenodoapi import ZenodoAPI
parser = argparse.ArgumentParser(description="Upload new deposit entry to Zenodo") parser = argparse.ArgumentParser(description="Upload new deposit entry to Zenodo")
......
...@@ -3,7 +3,7 @@ import os ...@@ -3,7 +3,7 @@ import os
import json import json
import argparse import argparse
from distutils.util import strtobool from distutils.util import strtobool
from .zenodoapi import ZenodoAPI from zenodoapi import ZenodoAPI
parser = argparse.ArgumentParser(description="Upload a new version of an existing deposit to Zenodo") parser = argparse.ArgumentParser(description="Upload a new version of an existing deposit to Zenodo")
......
...@@ -44,7 +44,7 @@ class ZenodoAPI: ...@@ -44,7 +44,7 @@ class ZenodoAPI:
headers = {"Content-Type": "application/json"} headers = {"Content-Type": "application/json"}
parameters = {'access_token': self.access_token} parameters = {'access_token': self.access_token}
return requests.post(url, headers=headers, params=parameters) return requests.post(url, json={}, headers=headers, params=parameters)
def upload_file_entry(self, entry_id, name_file, path_file): def upload_file_entry(self, entry_id, name_file, path_file):
""" """
...@@ -92,7 +92,7 @@ class ZenodoAPI: ...@@ -92,7 +92,7 @@ class ZenodoAPI:
headers = {"Content-Type": "application/json"} headers = {"Content-Type": "application/json"}
parameters = {'access_token': self.access_token} parameters = {'access_token': self.access_token}
return requests.put(url, data=json.dump(data), headers=headers, params=parameters) return requests.put(url, data=json.dumps(data), headers=headers, params=parameters)
def erase_file_entry(self, entry_id, file_id): def erase_file_entry(self, entry_id, file_id):
""" """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment