Skip to content

Commit 40a16cc

Browse files
committed
Keep all codemeta actions in one run
1 parent 428a5b1 commit 40a16cc

File tree

2 files changed

+21
-52
lines changed

2 files changed

+21
-52
lines changed

.github/workflows/codemeta2cff.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,27 @@ jobs:
1919
uses: actions/checkout@v4
2020
- name: Convert CFF
2121
uses: caltechlibrary/codemeta2cff@main
22+
- name: Install jq for JSON parsing
23+
run: sudo apt-get install -y jq
24+
- name: Parse and update setup.cfg
25+
run: |
26+
# Extract values from codemeta.json
27+
NAME=$(jq -r '.name' codemeta.json)
28+
VERSION=$(jq -r '.version' codemeta.json)
29+
AUTHORS=$(jq -r '[.author[] | .givenName + " " + .familyName] | join(", ")' codemeta.json)
30+
AUTHOR_EMAILS=$(jq -r '[.author[] | .email // empty] | join(", ")' codemeta.json)
31+
DESCRIPTION=$(jq -r '.description' codemeta.json)
32+
URL=$(jq -r '.codeRepository // .url' codemeta.json)
33+
34+
# Update setup.cfg fields
35+
sed -i "s/^name = .*/name = $NAME/" setup.cfg
36+
sed -i "s/^version = .*/version = $VERSION/" setup.cfg
37+
sed -i "s/^author = .*/author = $AUTHORS/" setup.cfg
38+
sed -i "s/^author_email = .*/author_email = $AUTHOR_EMAILS/" setup.cfg
39+
sed -i "s/^description = .*/description = $DESCRIPTION/" setup.cfg
40+
sed -i "s|^url = .*|url = $URL|" setup.cfg
2241
- name: Commit CFF
2342
uses: EndBug/add-and-commit@v9
2443
with:
25-
message: 'Add updated CITATION.cff from codemeta.json file'
26-
add: 'CITATION.cff'
44+
message: 'Add updated CITATION.cff and setup.cfg from codemeta.json file'
45+
add: '["setup.cfg", "CITATION.cff"]'

.github/workflows/update_setupcfg.yaml

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)