Skip to content

Update Zenodo Record with New Version #15

Update Zenodo Record with New Version

Update Zenodo Record with New Version #15

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&nbsp;(<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>).&nbsp;</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"