1- name : InvenioRDM GitHub Archiver and CodeMeta2CFF
21env :
32 INVENIO_SERVER : https://data.caltech.edu
43
109 parent_record : " 6qhkm-7n074"
1110 debug : false
1211
13- # ~~~~~~~~~~ The rest of this file should be left as-is ~~~~~~~~~~
12+ # This variable is a setting for post-archiving CodeMeta file updates.
13+ # If you don't have a CodeMeta file, you can remove the add_doi_codemeta
14+ # and Coremeta2CFF jobs at the bottom of this file.
15+ ref : main
16+
17+ # ╭────────────────────────────────────────────╮
18+ # │ The rest of this file should be left as-is │
19+ # ╰────────────────────────────────────────────╯
20+
21+ name : InvenioRDM GitHub Archiver
1422on :
1523 release :
1624 types : [published]
1725 workflow_dispatch :
1826 inputs :
1927 release_tag :
20- description : " The tag of the release to archive:"
28+ description : The release tag (empty = latest)
29+ parent_record :
30+ description : ID of parent record (for versioning)
31+ community :
32+ description : Name of InvenioRDM community (if any)
2133 draft :
22- default : false
23- description : " Mark the record as a draft: "
34+ description : Mark the record as a draft
35+ type : boolean
2436 all_assets :
25- default : false
26- description : " Attach all GitHub assets: "
37+ description : Attach all GitHub assets
38+ type : boolean
2739 all_metadata :
28- default : false
29- description : " Include additional GitHub metadata:"
30- community :
31- description : " Send record to InvenioRDM community:"
32- parent_record :
33- description : " ID of parent record (for versioning):"
40+ description : Include additional GitHub metadata
41+ type : boolean
42+ debug :
43+ description : Print debug info in the GitHub log
44+ type : boolean
45+
46+ run-name : Archive ${{inputs.release_tag || 'latest release'}} in InvenioRDM
3447jobs :
35- CodeMeta2CFF :
36- runs-on : ubuntu-latest
37- steps :
38- - name : Checkout
39- uses : actions/checkout@v4
40- - name : Convert CFF
41- uses : caltechlibrary/codemeta2cff@main
42- - name : Commit CFF
43- uses : EndBug/add-and-commit@v9
44- with :
45- message : ' Add CITATION.cff for release'
46- add : " ['CITATION.cff']"
47- push : origin HEAD:main
4848 run_iga :
49- name : " Send to ${{needs.get_repository.outputs.server}}"
49+ name : Send to ${{needs.get_repository.outputs.server}}
5050 runs-on : ubuntu-latest
51- needs : [get_repository, CodeMeta2CFF]
51+ needs : get_repository
52+ outputs :
53+ record_doi : ${{steps.iga.outputs.record_doi}}
5254 steps :
53- - uses : caltechlibrary/iga@main
55+ - uses : caltechlibrary/iga@v1
56+ id : iga
5457 with :
5558 INVENIO_SERVER : ${{env.INVENIO_SERVER}}
5659 INVENIO_TOKEN : ${{secrets.INVENIO_TOKEN}}
@@ -62,10 +65,44 @@ jobs:
6265 parent_record : ${{github.event.inputs.parent_record || env.parent_record}}
6366 release_tag : ${{github.event.inputs.release_tag || 'latest'}}
6467 get_repository :
65- name : " Get repository name"
68+ name : Get repository name
6669 runs-on : ubuntu-latest
6770 outputs :
6871 server : ${{steps.parse.outputs.host}}
6972 steps :
70- - id : parse
73+ - name : Extract name from INVENIO_SERVER
74+ id : parse
7175 run : echo "host=$(cut -d'/' -f3 <<< ${{env.INVENIO_SERVER}} | cut -d':' -f1)" >> $GITHUB_OUTPUT
76+ add_doi_codemeta :
77+ name : " Add ${{needs.run_iga.outputs.record_doi}} to codemeta.json"
78+ needs : run_iga
79+ runs-on : ubuntu-latest
80+ steps :
81+ - name : Checkout
82+ uses : actions/checkout@v4
83+ with :
84+ ref : ${{ env.ref }}
85+ - name : Install sde
86+ run : pip install sde
87+ - name : Add DOI to CodeMeta File
88+ run : sde identifier ${{needs.run_iga.outputs.record_doi}} codemeta.json
89+ - name : Commit CFF
90+ uses : EndBug/add-and-commit@v9
91+ with :
92+ message : ' Add DOI to codemeta.json file'
93+ add : ' codemeta.json'
94+ CodeMeta2CFF :
95+ runs-on : ubuntu-latest
96+ needs : add_doi_codemeta
97+ steps :
98+ - name : Checkout
99+ uses : actions/checkout@v4
100+ with :
101+ ref : ${{ env.ref }}
102+ - name : Convert CFF
103+ uses : caltechlibrary/codemeta2cff@main
104+ - name : Commit CFF
105+ uses : EndBug/add-and-commit@v9
106+ with :
107+ message : ' Add updated CITATION.cff from codemeta.json file'
108+ add : ' CITATION.cff'
0 commit comments