Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Quid
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Schlüsselstellen
Quid
Commits
e35d39d2
Commit
e35d39d2
authored
3 years ago
by
Frederik Arnold
Browse files
Options
Downloads
Plain Diff
Merge branch 'release/v.1.3.2'
parents
c4dd9949
16830ea6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#37371
passed
3 years ago
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+12
-1
12 additions, 1 deletion
.gitlab-ci.yml
setup.cfg
+1
-1
1 addition, 1 deletion
setup.cfg
zenodo.py
+89
-0
89 additions, 0 deletions
zenodo.py
with
102 additions
and
2 deletions
.gitlab-ci.yml
+
12
−
1
View file @
e35d39d2
...
...
@@ -16,6 +16,7 @@ stages:
-
badge
-
upload
-
release
-
zenodo
test
:
stage
:
test
...
...
@@ -65,4 +66,14 @@ release_job:
name
:
'
Lotte
$CI_COMMIT_TAG'
description
:
'
Release
$CI_COMMIT_TAG'
only
:
-
tags
\ No newline at end of file
-
tags
zenodo_upload
:
stage
:
zenodo
before_script
:
-
pip install requests
script
:
-
git archive --format zip --output Lotte-$CI_COMMIT_TAG.zip $CI_COMMIT_TAG
-
python zenodo.py --access-token $ZENODO_ACCESS_TOKEN --id 6123229 --title Lotte --version $CI_COMMIT_TAG --file-path Lotte-$CI_COMMIT_TAG.zip
only
:
-
tags
\ No newline at end of file
This diff is collapsed.
Click to expand it.
setup.cfg
+
1
−
1
View file @
e35d39d2
[metadata]
# replace
with your username:
name
= Lotte
version
= 1.3.
1
version
= 1.3.
2
author
= Frederik Arnold
author_email
= frederik.arnold@hu-berlin.de
description
= Lotte is a tool for quotation detection in texts and can deal with common properties of quotations, for example, ellipses or inaccurate quotations.
...
...
This diff is collapsed.
Click to expand it.
zenodo.py
0 → 100644
+
89
−
0
View file @
e35d39d2
import
requests
import
json
from
argparse
import
ArgumentParser
# base_url = 'https://sandbox.zenodo.org/api/'
base_url
=
'
https://zenodo.org/api/
'
def
__get_latest_url
(
global_id
,
access_token
):
request_url
=
f
"
{
base_url
}
deposit/depositions/
{
global_id
}
?access_token=
{
access_token
}
"
response
=
requests
.
get
(
request_url
)
response
.
raise_for_status
()
data
=
response
.
json
()
if
'
latest_draft
'
in
data
[
'
links
'
]:
raise
Exception
(
'
There is already a draft!
'
)
return
data
[
'
links
'
][
'
newversion
'
]
def
__create_new_version
(
new_version_url
,
access_token
):
response
=
requests
.
post
(
new_version_url
,
params
=
{
'
access_token
'
:
access_token
})
response
.
raise_for_status
()
data
=
response
.
json
()
return
data
def
__update_metadata
(
draft_url
,
access_token
,
data
):
request_url
=
f
"
{
draft_url
}
?access_token=
{
access_token
}
"
headers
=
{
"
Content-Type
"
:
"
application/json
"
}
response
=
requests
.
put
(
request_url
,
data
=
json
.
dumps
(
data
),
headers
=
headers
)
response
.
raise_for_status
()
def
__upload_file
(
draft_url
,
access_token
,
filename
,
file_path
):
request_url
=
f
'
{
draft_url
}
/files?access_token=
{
access_token
}
'
data
=
{
'
name
'
:
filename
}
files
=
{
'
file
'
:
open
(
file_path
,
'
rb
'
)}
response
=
requests
.
post
(
request_url
,
data
=
data
,
files
=
files
)
response
.
raise_for_status
()
def
main
():
argument_parser
=
ArgumentParser
()
argument_parser
.
add_argument
(
"
--access-token
"
,
dest
=
"
access_token
"
,
help
=
"
The access token
"
,
required
=
True
)
argument_parser
.
add_argument
(
"
--id
"
,
dest
=
"
global_id
"
,
help
=
"
The global id
"
,
required
=
True
)
argument_parser
.
add_argument
(
"
--title
"
,
dest
=
"
title
"
,
help
=
"
The title
"
,
required
=
True
)
argument_parser
.
add_argument
(
"
--version
"
,
dest
=
"
version
"
,
help
=
"
The version
"
,
required
=
True
)
argument_parser
.
add_argument
(
"
--file-path
"
,
dest
=
"
file_path
"
,
help
=
"
The file path
"
,
required
=
True
)
args
=
argument_parser
.
parse_args
()
access_token
=
args
.
access_token
global_id
=
args
.
global_id
title
=
args
.
title
version
=
args
.
version
file_path
=
args
.
file_path
if
version
.
startswith
(
'
v.
'
):
version
=
version
[
2
:]
elif
version
.
startswith
(
'
v
'
):
version
=
version
[
1
:]
new_version_url
=
__get_latest_url
(
global_id
,
access_token
)
new_version_data
=
__create_new_version
(
new_version_url
,
access_token
)
draft_url
=
new_version_data
[
'
links
'
][
'
latest_draft
'
]
updated_metadata
=
{
'
metadata
'
:
new_version_data
[
'
metadata
'
]}
del
updated_metadata
[
'
metadata
'
][
'
doi
'
]
updated_metadata
[
'
metadata
'
][
'
title
'
]
=
f
'
{
title
}
v.
{
version
}
'
updated_metadata
[
'
metadata
'
][
'
version
'
]
=
version
__update_metadata
(
draft_url
,
access_token
,
updated_metadata
)
filename
=
f
'
{
title
}
-v.
{
version
}
.zip
'
__upload_file
(
draft_url
,
access_token
,
filename
,
file_path
)
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment