-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
90 lines (83 loc) · 2.68 KB
/
action.yml
File metadata and controls
90 lines (83 loc) · 2.68 KB
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
name: "Zenodo Release Action"
description: "Release zenodo metadata so you don't have to give admin hook access"
inputs:
zenodo_json:
description: .zenodo.json or CITATION.cff file (must be valid)
doi:
descripton: The parent DOI to create a new version for
token:
description: zenodo token
required: true
outputs:
badge:
description: badge url
value: ${{ steps.deploy.outputs.badge }}
bucket:
description: bucket url
value: ${{ steps.deploy.outputs.bucket }}
conceptbadge:
description: concept badge url
value: ${{ steps.deploy.outputs.conceptbadge }}
conceptdoi:
description: concept doi url
value: ${{ steps.deploy.outputs.conceptdoi }}
doi:
description: doi url
value: ${{ steps.deploy.outputs.doi }}
latest:
description: latest url
value: ${{ steps.deploy.outputs.latest }}
latest_html:
description: latest html url
value: ${{ steps.deploy.outputs.latest_html }}
record:
description: record url
value: ${{ steps.deploy.outputs.record }}
record_html:
description: record html url
value: ${{ steps.deploy.outputs.record_html }}
runs:
using: "composite"
steps:
- name: download archive to runner
env:
zipball: ${{ github.event.release.zipball_url }}
run: |
name=$(basename ${zipball}).zip
curl -L $zipball > $name
echo "archive=${name}" >> $GITHUB_ENV
shell: bash
- name: create zenodo.json file
run: |
if [[ "${zenodo_json}" == "CITATION.cff" ]]; then
pip install --user cffconvert
cffconvert -f zenodo > zenodo.json
cat zenodo.json
fi
shell: bash
- name: Deploy Zenodo
id: deploy
env:
zenodo_json: ${{ inputs.zenodo_json }}
archive: ${{ env.archive }}
version: ${{ github.event.release.tag_name }}
ACTION_PATH: ${{ github.action_path }}
ZENODO_TOKEN: ${{ inputs.token }}
doi: ${{ inputs.doi }}
html_url: ${{ github.event.release.html_url }}
run: |
pip install markdown
command="python ${{ github.action_path }}/scripts/deploy.py upload ${archive} --version ${version} --html-url ${html_url}"
if [[ "${doi}" != "" ]]; then
command="$command --doi ${doi}"
fi
if [[ "${zenodo_json}" == "CITATION.cff" ]]; then
command="$command --zenodo-json zenodo.json"
else
command="$command --zenodo-json ${zenodo_json}"
fi
echo '## Release Name: ${{ github.event.release.name }}' > body.txt
echo '${{ github.event.release.body }}' >> body.txt
printf "$command\n"
$command
shell: bash