-
Notifications
You must be signed in to change notification settings - Fork 2
103 lines (95 loc) · 3.92 KB
/
iga.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
# GitHub Actions workflow for InvenioRDM GitHub Archiver version 1.2.2
# This is available as the file "sample-workflow.yml" from the open-
# source repository for IGA at https://github.com/caltechlibrary/iga/.
# ╭────────────────────────────────────────────╮
# │ Configure this section │
# ╰────────────────────────────────────────────╯
env:
INVENIO_SERVER: https://data.caltech.edu
# Set to an InvenioRDM record ID to mark release as a new version.
parent_record: none
# The variables below are other IGA options. Please see the docs.
community: none
draft: false
all_assets: false
all_metadata: false
debug: false
# This variable is a setting for post-archiving CodeMeta file updates.
# If you don't have a CodeMeta file, you can remove the add_doi_codemeta
# job at the bottom of this file.
ref: main
# ╭────────────────────────────────────────────╮
# │ The rest of this file should be left as-is │
# ╰────────────────────────────────────────────╯
name: InvenioRDM GitHub Archiver
on:
release:
types: [published]
workflow_dispatch:
inputs:
release_tag:
description: The release tag (empty = latest)
parent_record:
description: ID of parent record (for versioning)
community:
description: Name of InvenioRDM community (if any)
draft:
description: Mark the record as a draft
type: boolean
all_assets:
description: Attach all GitHub assets
type: boolean
all_metadata:
description: Include additional GitHub metadata
type: boolean
debug:
description: Print debug info in the GitHub log
type: boolean
run-name: Archive ${{inputs.release_tag || 'latest release'}} in InvenioRDM
jobs:
run_iga:
name: Send to ${{needs.get_repository.outputs.server}}
runs-on: ubuntu-latest
needs: get_repository
outputs:
record_doi: ${{steps.iga.outputs.record_doi}}
steps:
- uses: caltechlibrary/iga@v1
id: iga
with:
INVENIO_SERVER: ${{env.INVENIO_SERVER}}
INVENIO_TOKEN: ${{secrets.INVENIO_TOKEN}}
all_assets: ${{github.event.inputs.all_assets || env.all_assets}}
all_metadata: ${{github.event.inputs.all_metadata || env.all_metadata}}
debug: ${{github.event.inputs.debug || env.debug}}
draft: ${{github.event.inputs.draft || env.draft}}
community: ${{github.event.inputs.community || env.community}}
parent_record: ${{secrets.parent_record || github.event.inputs.parent_record || env.parent_record}}
release_tag: ${{github.event.inputs.release_tag || 'latest'}}
get_repository:
name: Get repository name
runs-on: ubuntu-latest
outputs:
server: ${{steps.parse.outputs.host}}
steps:
- name: Extract name from INVENIO_SERVER
id: parse
run: echo "host=$(cut -d'/' -f3 <<< ${{env.INVENIO_SERVER}} | cut -d':' -f1)" >> $GITHUB_OUTPUT
add_doi_codemeta:
name: "Add ${{needs.run_iga.outputs.record_doi}} to codemeta.json"
needs: run_iga
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- name: Install sde
run: pip install sde
- name: Add DOI to CodeMeta File
run: sde identifier ${{needs.run_iga.outputs.record_doi}} codemeta.json
- name: Commit CFF
uses: EndBug/add-and-commit@v9
with:
message: 'Add DOI to codemeta.json file'
add: 'codemeta.json'