-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (132 loc) · 6.45 KB
/
upload-to-zenodo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Update Zenodo Record with New Version
on:
workflow_dispatch:
jobs:
update-zenodo-record:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install curl and jq
run: sudo apt-get install -y curl jq
- name: Discard Current Draft
run: |
discard_response=$(curl -s -X POST -H "Authorization: Bearer ${{ secrets.ZENODO_ACCESS_TOKEN }}" \
"https://zenodo.org/api/deposit/depositions/${{ secrets.ZENODO_DEPOSITION_ID }}/actions/discard")
echo "Discard Response: $discard_response"
if echo "$discard_response" | grep -q '"status": 403'; then
echo "Failed to discard the draft. The draft might be locked or in an invalid state."
exit 1
fi
- name: Create a New Version of the Deposition
id: new_version
run: |
# Attempt to create a new version and capture the full response
response=$(curl -s -X POST -H "Authorization: Bearer ${{ secrets.ZENODO_ACCESS_TOKEN }}" \
"https://zenodo.org/api/deposit/depositions/${{ secrets.ZENODO_DEPOSITION_ID }}/actions/newversion")
echo "Response: $response"
# Extract the latest draft URL from the response
new_draft_url=$(echo "$response" | jq -r '.links.latest_draft')
if [[ "$new_draft_url" == "null" || -z "$new_draft_url" ]]; then
echo "Failed to retrieve the latest draft URL. Response was: $response"
exit 1
fi
# Fetch the new draft deposition details
new_draft_response=$(curl -s -H "Authorization: Bearer ${{ secrets.ZENODO_ACCESS_TOKEN }}" "$new_draft_url")
echo "New Draft Response: $new_draft_response"
# Extract necessary information for the next steps
new_deposition_id=$(echo "$new_draft_response" | jq -r '.id')
new_bucket_url=$(echo "$new_draft_response" | jq -r '.links.bucket')
if [[ "$new_deposition_id" == "null" || -z "$new_deposition_id" ]]; then
echo "Failed to retrieve the new deposition ID. New draft response was: $new_draft_response"
exit 1
fi
echo "New Deposition ID: $new_deposition_id"
echo "New Bucket URL: $new_bucket_url"
echo "new_deposition_id=$new_deposition_id" >> $GITHUB_ENV
echo "new_bucket_url=$new_bucket_url" >> $GITHUB_ENV
- name: Debug New Bucket URL
run: echo "$new_bucket_url"
- name: Upload files to Zenodo
run: |
for file in data/*.ttl; do
curl --progress-bar -H "Authorization: Bearer ${{ secrets.ZENODO_ACCESS_TOKEN }}" \
--upload-file $file "$new_bucket_url/$(basename $file)"
done
- name: Update Metadata for New Version
run: |
metadata=$(cat <<EOF
{
"metadata": {
"title": "Adverse Outcome Pathway Wiki RDF",
"doi": "10.5281/zenodo.***", # Replace with your actual DOI
"publication_date": "2023-10-31", # Use the existing publication date
"description": "<p>This dataset is the RDF generated from the AOP-Wiki data release (<a href=\"https://aopwiki.org/downloads\">aopwiki.org/downloads</a>). It was generated using a Jupyter notebook that is available on GitHub (<a href=\"https://github.com/marvinm2/AOPWikiRDF\">github.com/marvinm2/AOPWikiRDF</a>), and the process and additional description of the RDF have been published (<a href=\"https://doi.org/10.1089/aivt.2021.0010\">doi.org/10.1089/aivt.2021.0010</a>). </p>",
"access_right": "open",
"creators": [
{
"name": "Martens, Marvin",
"affiliation": "Department of Bioinformatics (BiGCaT), NUTRIM, Maastricht University, Maastricht, the Netherlands",
"orcid": "0000-0003-2230-0840"
},
{
"name": "Willighagen, Egon",
"affiliation": "Department of Bioinformatics (BiGCaT), NUTRIM, Maastricht University, Maastricht, the Netherlands",
"orcid": "0000-0001-7542-0286"
},
{
"name": "Evelo, Chris",
"affiliation": "Department of Bioinformatics (BiGCaT), NUTRIM, Maastricht University, Maastricht, the Netherlands",
"orcid": "0000-0002-5301-3142"
}
],
# "keywords": [
# "AOP-Wiki",
# "Resource Description Framework",
# "Adverse Outcome Pathways"
# ],
"related_identifiers": [
{
"identifier": "10.1089/aivt.2021.0010",
"relation": "references",
"resource_type": "publication-article",
"scheme": "doi"
}
],
"references": [
"10.1089/aivt.2021.0010"
],
"language": "eng",
"grants": [
{"id": "10.13039/501100000780::814572"},
{"id": "10.13039/501100000780::681002"},
{"id": "10.13039/501100000780::814425"},
{"id": "10.13039/501100000780::731075"},
{"id": "10.13039/501100003246::36952"}
],
"license": "cc-by-4.0",
"communities": [
{
"identifier": "nsc"
},
{
"identifier": "vhp4safety"
},
{
"identifier": "nanosolveit"
}
],
"notes": "Funded by the European Union's Horizon 2020 (EU 2020) research and innovation program under grant agreement no. 681002 (EU-ToxRisk), grant agreement no. 814572 (NanoSolveIT), grant agreement no. 814425 (RiskGONE), EINFRA-22-2016 program under grant agreement no. 731075 (OpenRiskNet), and VHP4Safety, which is funded by the Netherlands Research Council (NWO) 'Netherlands Research Agenda: Research on Routes by Consortia' (NWA-ORC 1292.19.272)",
"upload_type": "dataset"
}
}
EOF
)
curl -H "Authorization: Bearer ${{ secrets.ZENODO_ACCESS_TOKEN }}" \
-H "Content-Type: application/json" \
-X PUT --data "$metadata" "https://zenodo.org/api/deposit/depositions/$new_deposition_id"
- name: Publish Updated Zenodo Record
run: |
curl -H "Authorization: Bearer ${{ secrets.ZENODO_ACCESS_TOKEN }}" \
-H "Content-Type: application/json" \
-X POST "https://zenodo.org/api/deposit/depositions/$new_deposition_id/actions/publish"