-
Notifications
You must be signed in to change notification settings - Fork 15
754 lines (686 loc) · 28.7 KB
/
on_gpml_change.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
name: When GPML changed, do everything
on:
workflow_dispatch:
push:
branches:
- main
paths:
- pathways/**/*.gpml
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: false # to allow multiple runs to queue up rather than clobber
jobs:
# inspired by https://dev.to/scienta/get-changed-files-in-github-actions-1p36
changed-gpmls:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
added-modified: ${{ steps.changes.outputs.added-modified }}
copied: ${{ steps.changes.outputs.copied }}
deleted: ${{ steps.changes.outputs.deleted }}
renamed: ${{ steps.changes.outputs.renamed }}
steps:
# Make sure we have some code to diff.
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Get changed files
id: changes
# Set outputs using the command.
run: |
echo "GPML files were changed in pull request ${{ github.event.before }} -> ${{ github.event.after }}"
#echo "::set-output name=added-modified::$(git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)"
echo "added-modified=$(git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)" >> $GITHUB_OUTPUT
if git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$; then
echo 'added or modified:'
git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$
fi
#echo "::set-output name=copied::$(git diff --name-only --diff-filter=C ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)"
echo "copied=$(git diff --name-only --diff-filter=C ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)" >> $GITHUB_OUTPUT
if git diff --name-only --diff-filter=C ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$; then
echo 'copied:'
git diff --name-only --diff-filter=C ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$
fi
#echo "::set-output name=deleted::$(git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)"
echo "deleted=$(git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)" >> $GITHUB_OUTPUT
if git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$; then
echo 'deleted:'
git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$
fi
#echo "::set-output name=renamed::$(git diff --name-only --diff-filter=R ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)"
echo "renamed=$(git diff --name-only --diff-filter=R ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)" >> $GITHUB_OUTPUT
if git diff --name-only --diff-filter=R ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$; then
echo 'renamed:'
git diff --name-only --diff-filter=R ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$
fi
author-list:
runs-on: ubuntu-latest
needs: changed-gpmls
# only run if gpmls were added or modified
if: ${{needs.changed-gpmls.outputs.added-modified}}
steps:
- name: Checkout wikipathways-database repo
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: main
- name: Checkout jekyll repo
uses: actions/checkout@v4
with:
repository: wikipathways/wikipathways.github.io
path: wikipathways.github.io
submodules: true
fetch-depth: 1
ref: main
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
- name: Update author list and create md profiles
run: |
authorList=()
{
read #skip header line
while IFS=, read -r username realname orcid wikidata github; do
authorList+=("$username")
done
}< scripts/author_list.csv
echo ${#authorList[@]}
uniqueAuthors=()
for f in ${{needs.changed-gpmls.outputs.added-modified}}; do
auth="$(sed -n '/<Pathway /s/.*Author=\"\[\(.*\)\]\".*/\1/p' $f )"
IFS=',' read -r -a curAuthors <<< "$auth"
echo $curAuthors
echo ${#curAuthors[@]}
for i in "${curAuthors[@]}"; do
skip=
for j in "${uniqueAuthors[@]}"; do
[[ $i == $j ]] && { skip=1; break; }
done
[[ -n $skip ]] || uniqueAuthors+=("$i")
done
done
echo ${uniqueAuthors[@]}
echo ${#uniqueAuthors[@]}
for a in "${uniqueAuthors[@]}"; do
a=$(echo "$a" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
a1=${a//AAR&Co/AARandCo}
a1=${a//Önder/Onder}
a2=$(echo "$a" | tr ' ' '_')
if [[ ! " ${authorList[*]} " =~ " ${a} " ]]; then
echo "Adding $a"
echo $a","$a",,," >> scripts/author_list.csv
echo "---" > "wikipathways.github.io/_authors/$a1.md"
echo "username: $a1" >> "wikipathways.github.io/_authors/$a1.md"
echo "realname: $a" >> "wikipathways.github.io/_authors/$a1.md"
echo "website: " >> "wikipathways.github.io/_authors/$a1.md"
echo "affiliation: " >> "wikipathways.github.io/_authors/$a1.md"
echo "bio: " >> "wikipathways.github.io/_authors/$a1.md"
echo "github: " >> "wikipathways.github.io/_authors/$a1.md"
echo "orcid: " >> "wikipathways.github.io/_authors/$a1.md"
echo "linkedin: " >> "wikipathways.github.io/_authors/$a1.md"
echo "googlescholar: " >> "wikipathways.github.io/_authors/$a1.md"
echo "wikidata: " >> "wikipathways.github.io/_authors/$a1.md"
echo "twitter: " >> "wikipathways.github.io/_authors/$a1.md"
echo "mastodon-url: " >> "wikipathways.github.io/_authors/$a1.md"
echo "meta:" >> "wikipathways.github.io/_authors/$a1.md"
echo "instagram:" >> "wikipathways.github.io/_authors/$a1.md"
echo "email:" >> "wikipathways.github.io/_authors/$a1.md"
echo "redirect_from:" >> "wikipathways.github.io/_authors/$a1.md"
echo "- /index.php/User:$a2" >> "wikipathways.github.io/_authors/$a1.md"
echo "- /index.php/Special:Contributions/$a2" >> "wikipathways.github.io/_authors/$a1.md"
echo "---" >> "wikipathways.github.io/_authors/$a1.md"
fi
done
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add scripts/author_list.csv
if git diff --exit-code --staged; then
echo "No changes"
else
git commit -m 'Update author_list file'
git pull --rebase
git push
fi
cd "${{ github.workspace }}/wikipathways.github.io/_authors"
git add .
if git diff --exit-code --staged > /dev/null; then
echo "No changes"
else
git commit -m 'Created new author profiles'
git pull --rebase
git push
fi
metadata:
runs-on: ubuntu-latest
needs: changed-gpmls
# only run if gpmls were added or modified
if: ${{needs.changed-gpmls.outputs.added-modified}}
steps:
- name: Checkout wikipathways-database repo
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: main
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Cache meta-data-action with dependencies
uses: actions/cache@v4
id: cacheMetaJar
with:
path: ./meta-data-action-1.1.4-jar-with-dependencies.jar
key: cached-meta-data-action-${{ hashFiles('meta-data-action-1.1.4-jar-with-dependencies.jar') }}
restore-keys: |
cached-meta-data-action-${{ hashFiles('meta-data-action-1.1.4-jar-with-dependencies.jar') }}
cached-meta-data-action-
- if: steps.cacheMetaJar.outputs.cache-hit != 'true'
name: Install deps
run: |
echo "Cache not found: cached-meta-data-action"
if [ ! -e ./meta-data-action-1.1.4-jar-with-dependencies.jar ]; then
wget -O meta-data-action-1.1.4-jar-with-dependencies.jar https://github.com/wikipathways/meta-data-action/releases/download/v1.1.4/meta-data-action-1.1.4-jar-with-dependencies.jar
fi
- name: Cache all bridge files
uses: actions/cache@v4
id: cacheAllBridge
with:
path: |
./metabolites*.bridge
./Ag*.bridge
./An*.bridge
./At*.bridge
./Bs*.bridge
./Bt*.bridge
./Ce*.bridge
./Cf*.bridge
./Ci*.bridge
./Dr*.bridge
./Da*.bridge
./Dp*.bridge
./Dm*.bridge
./Ec*.bridge
./Gg*.bridge
./Fg*.bridge
./Gm*.bridge
./Hs*.bridge
./Hv*.bridge
./Ml*.bridge
./Mm*.bridge
./Mx*.bridge
./Oa*.bridge
./Ova*.bridge
./Oi*.bridge
./Oj*.bridge
./Pi*.bridge
./Pt*.bridge
./Qc*.bridge
./Rn*.bridge
./Sc*.bridge
./Sl*.bridge
./Ss*.bridge
./Vv*.bridge
./Xt*.bridge
./Zm*.bridge
key: cached-bridge-files
restore-keys: |
cached-bridge-files
- if: steps.cacheAllBridge.outputs.cache-hit != 'true'
name: Install all bridge files
run: |
echo "Cache not found: cached-bridge-files"
declare -a OrganismNames=("Metabolites" "Anopheles gambiae" "Aspergillus niger" "Arabidopsis thaliana" "Bacillus subtilis" "Bos taurus" "Caenorhabditis elegans" "Canis familiaris" "Ciona intestinalis" "Danio rerio" "Daphnia magna" "Daphnia pulex" "Drosophila melanogaster" "Escherichia coli" "Gallus gallus" "Fusarium graminearum" "Glycine max" "Homo sapiens" "Hordeum vulgare" "Macaca mulatta" "Mus musculus" "Mycobacterium tuberculosis" "Ornithorhynchus anatinus" "Ovis aries" "Oryza indica" "Oryza japonica" "Populus trichocarpa" "Pan troglodytes" "Equus caballus" "Rattus norvegicus" "Saccharomyces cerevisiae" "Solanum lycopersicum" "Sus scrofa" "Vitis vinifera" "Xenopus tropicalis" "Zea mays")
for org in "${OrganismNames[@]}"; do
echo "generating configuration files for "$org""
scripts/meta-data-action/configGenerator.sh "$org"
echo "installing bridgedb files for "$org""
scripts/meta-data-action/installDependencies.sh "$org"
done
- name: Generate configs, install bridgeDb, generate info and datanode files
run: |
chmod 777 meta-data-action-1.1.4-jar-with-dependencies.jar
for f in ${{needs.changed-gpmls.outputs.added-modified}}; do
org="$(sed -n '/<Pathway /s/.*Organism=\(.*\)[^\n]*/\1/p' $f | tr -d '"' | tr -d '>' | tr -d '\r')"
echo "generating configuration files for "$org""
scripts/meta-data-action/configGenerator.sh "$org"
wpid="$(basename ""$f"" | sed 's/.gpml//')"
cat gdb.config
echo "generating info and datanode files for $wpid, organism "$org""
java -jar meta-data-action-1.1.4-jar-with-dependencies.jar wikipathways/wikipathways-database "$f" $(date --utc +%F) gdb.config "$org"
done
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add pathways/WP*/WP*.{json,tsv}
if git diff --exit-code --staged; then
echo "No changes"
else
git commit -m 'Update metadata files'
git pull --rebase
git push
fi
pubmed:
runs-on: ubuntu-latest
needs: [changed-gpmls, metadata]
# only run if gpmls were added or modified
if: ${{needs.changed-gpmls.outputs.added-modified}}
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
ref: main
- name: Install dependencies
working-directory: scripts/generate-references
run: npm install
- name: Generate references
working-directory: scripts/generate-references
run: node index.js
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add pathways/*/*-bibliography.tsv
if git diff --exit-code --staged; then
echo "No changes"
else
git commit -m 'Update formatted references'
git pull --rebase
git push
fi
frontmatter:
runs-on: ubuntu-latest
needs: [changed-gpmls, metadata, pubmed]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
ref: main
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install deps
run: |
pip install python-frontmatter
- name: Create pathway frontmatter
run: |
for f in ${{needs.changed-gpmls.outputs.added-modified}}; do
wpid="$(basename ""$f"" | sed 's/.gpml//')"
echo "generating frontmatter file for $wpid"
json_info_f=./pathways/"$wpid"/"$wpid"-info.json
if [ -e "$json_info_f" ]; then
python scripts/create_pathway_frontmatter.py "$json_info_f"
sed -i 's/AAR&Co/AARandCo/g' ./pathways/"$wpid"/"$wpid".md
sed -i 's/Önder/Onder/g' ./pathways/"$wpid"/"$wpid".md
else
echo "info.json file missing for $wpid" >2
fi
done
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add pathways/*/*.md
if git diff --exit-code --staged; then
echo "No changes"
else
git commit -m 'Update frontmatter .md files'
git pull --rebase
git push
fi
homology-conversion:
runs-on: ubuntu-latest
needs: changed-gpmls
# only run if gpmls were added or modified
if: ${{needs.changed-gpmls.outputs.added-modified}}
steps:
- name: Checkout wikipathways-database repo
uses: actions/checkout@v4
with:
path: wikipathways-database
fetch-depth: 1
ref: main
- name: Checkout homology repo
uses: actions/checkout@v4
with:
repository: wikipathways/wikipathways-homology
path: wikipathways-homology
fetch-depth: 1
ref: main
ssh-key: ${{ secrets.ACTIONS_HOMOLOGY_KEY }}
- name: Set up ssh-agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.ACTIONS_HOMOLOGY_KEY }} ## for push into wp-homology repo
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Cache and install dependencies
uses: actions/cache@v4
id: cache
with:
path: ${{ github.workspace }}/wikipathways-database/Hs_Derby_Ensembl_108.bridge
key: ${{ runner.os }}-java-Hs_Derby_Ensembl_108
restore-keys: |
${{ runner.os }}-java-Hs_Derby_Ensembl_108
${{ runner.os }}-java-Hs_Derby_Ensembl_
- if: steps.cache.outputs.cache-hit != 'true'
name: Install deps
run: |
cd "${{ github.workspace }}/wikipathways-database"
if [ ! -e ./Hs_Derby_Ensembl_108.bridge ]; then
wget -O Hs_Derby_Ensembl_108.bridge https://zenodo.org/record/7781913/files/Hs_Derby_Ensembl_108.bridge?download=1
fi
- name: Perform homology conversion
run: |
cd "${{ github.workspace }}/wikipathways-database"
for value in Bt Cf Dr Qc Gg Mm Pt Rn Ss
do
mkdir -p scripts/homology-converter/outputs/"$value"
done
for f in ${{needs.changed-gpmls.outputs.added-modified}}; do
wpid="$(basename ""$f"" | sed 's/.gpml//')"
echo "perfoming homology conversion for $wpid ($f)"
java -jar HomologyMapperAuto-WithDependencies.jar scripts/homology-converter/properties/autorun.properties $wpid
done
- name: Move gpml and log files from database repo to homology repo
run: |
cd "${{ github.workspace }}/wikipathways-database"
HM_PATH="${{ github.workspace }}/wikipathways-homology"
echo "move logs to wikipathways-homology"
mkdir -p $HM_PATH/logs
mv scripts/homology-converter/logs/*.txt $HM_PATH/logs/.
for f in ${{needs.changed-gpmls.outputs.added-modified}}; do
wpid="$(basename ""$f"" | sed 's/.gpml//')"
echo "copying gpml files for $wpid for all species"
for value in Bt Cf Dr Qc Gg Mm Pt Rn Ss
do
for hom_f in scripts/homology-converter/outputs/$value/$wpid/"$wpid"_"$value".gpml; do
echo "For $hom_f"
if [ -e "$hom_f" ]; then
echo "move to wikipathways-homology"
mkdir -p $HM_PATH/pathways/$value/$wpid
mv "$hom_f" $HM_PATH/pathways/$value/$wpid/"$wpid"_"$value".gpml
fi
done
done
done
- name: Commit gpml to homology repo
run: |
cd "${{ github.workspace }}/wikipathways-homology"
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add logs/*
for value in Bt Cf Dr Qc Gg Mm Pt Rn Ss
do
git add pathways/$value/WP*/WP*_$value.gpml
done
if git diff --exit-code --staged; then
echo "No changes"
else
git commit -m 'Update GPML files'
git pull --rebase
git push
fi
json-svg:
needs: [changed-gpmls, pubmed, frontmatter]
runs-on: ubuntu-latest
steps:
- name: Checkout wikipathways-database repo
uses: actions/checkout@v4
with:
path: wikipathways-database
submodules: true
fetch-depth: 1
ref: main
- name: Checkout assets repo
uses: actions/checkout@v4
with:
repository: wikipathways/wikipathways-assets
path: wikipathways-assets
submodules: true
fetch-depth: 1
ref: main
ssh-key: ${{ secrets.ACTIONS_ASSETS_KEY }}
- name: Set up ssh-agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.ACTIONS_ASSETS_KEY }} ## for push into wp-assets repo
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache NPM dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install deps
working-directory: wikipathways-database/scripts/generate-svgs
run: |
npm install
sudo apt-get update
sudo apt-get install -y xmlstarlet
- name: Convert GPML to JSON and SVG
run: |
DB_PATH="${{ github.workspace }}/wikipathways-database"
AS_PATH="${{ github.workspace }}/wikipathways-assets"
for f in ${{needs.changed-gpmls.outputs.added-modified}}; do
wpid="$(basename ""$f"" | sed 's/.gpml//')"
echo "generating JSON and SVG files for $wpid"
cd "$AS_PATH"
mkdir -p pathways/"$wpid"
for old_f in pathways/"$wpid"/"$wpid".{json,svg}; do
if [ -e "$old_f" ]; then
rm "$old_f"
fi
done
# cp gpml and tsv to assets
cp $DB_PATH/pathways/"$wpid"/"$wpid".gpml $AS_PATH/pathways/"$wpid"/
cp $DB_PATH/pathways/"$wpid"/"$wpid"-bibliography.tsv $AS_PATH/pathways/"$wpid"/
cp $DB_PATH/pathways/"$wpid"/"$wpid"-datanodes.tsv $AS_PATH/pathways/"$wpid"/
cd "$DB_PATH/scripts/generate-svgs"
./gpmlconverter --id "$wpid" -i $DB_PATH/pathways/"$wpid"/"$wpid".gpml -o $AS_PATH/pathways/"$wpid"/"$wpid".svg
# delete intermediate JSON files
rm $AS_PATH/pathways/"$wpid"/"$wpid".json.b4bridgedb.json || true
rm $AS_PATH/pathways/"$wpid"/"$wpid".b4wd.json || true
rm $AS_PATH/pathways/"$wpid"/"$wpid".b4hgnc.json || true
# mv thumbnail png
mv $AS_PATH/pathways/"$wpid"/"$wpid"-thumb.png $DB_PATH/pathways/"$wpid"/
# pretty print the JSON
for json_f in $AS_PATH/pathways/"$wpid"/"$wpid".json; do
mv "$json_f" "$json_f".tmp.json
jq -S . "$json_f".tmp.json >"$json_f"
rm "$json_f".tmp.json
done
done
- name: Commit report for assets
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
cd wikipathways-assets
git add pathways/WP*/WP*.{json,svg,png,gpml,tsv}
if git diff --exit-code --staged; then
echo "No changes"
else
git commit -m 'Update JSON, SVG, PNG, TSV and GPML files'
git pull --rebase
git push
fi
- name: Commit report for database
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
cd wikipathways-database
git add pathways/WP*/WP*-thumb.png
if git diff --exit-code --staged; then
echo "No changes"
else
git commit -m 'Update PNG files'
git pull --rebase --autostash
git push
fi
sync-site-repo-added-modified:
runs-on: ubuntu-latest
needs: [changed-gpmls, metadata, pubmed, frontmatter, json-svg]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: wikipathways-database
submodules: true
fetch-depth: 1
ref: main
- name: Checkout jekyll repo
uses: actions/checkout@v4
with:
repository: wikipathways/wikipathways.github.io
path: wikipathways.github.io
submodules: true
fetch-depth: 1
ref: main
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
- name: Set up ssh-agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.ACTIONS_DEPLOY_KEY }} ## for push into wp.gh.io repo
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
for f in ${{needs.changed-gpmls.outputs.added-modified}}; do
wpid="$(basename ""$f"" | sed 's/.gpml//')"
cp wikipathways-database/pathways/"$wpid"/"$wpid".md wikipathways.github.io/_pathways/
cp wikipathways-database/pathways/"$wpid"/"$wpid"-bibliography.tsv wikipathways.github.io/_data/
cp wikipathways-database/pathways/"$wpid"/"$wpid"-datanodes.tsv wikipathways.github.io/_data/
mkdir -p wikipathways.github.io/assets/img/"$wpid"
cp wikipathways-database/pathways/"$wpid"/"$wpid"-thumb.png wikipathways.github.io/assets/img/"$wpid"/
done
cd wikipathways.github.io
git add .
if git diff --exit-code --staged > /dev/null; then
echo "No changes"
else
git commit -m 'Update tsv, md and png files'
git pull --rebase
git push
fi
sync-assets-repo-deleted:
runs-on: ubuntu-latest
needs: changed-gpmls
# only run if gpmls were deleted
if: ${{needs.changed-gpmls.outputs.deleted}}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: wikipathways-database
submodules: true
fetch-depth: 1
ref: main
- name: Checkout assets repo
uses: actions/checkout@v4
with:
repository: wikipathways/wikipathways-assets
path: wikipathways-assets
submodules: true
fetch-depth: 1
ref: main
ssh-key: ${{ secrets.ACTIONS_ASSETS_KEY }}
- name: Set up ssh-agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.ACTIONS_ASSETS_KEY }} ## for push into wp-assets rep
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
cd wikipathways-assets
for f in ${{needs.changed-gpmls.outputs.deleted}}; do
wpid="$(basename ""$f"" | sed 's/.gpml//')"
echo "deleting $wpid from wikipathways-assets"
git rm pathways/"$wpid"/*
done
if git diff --exit-code --staged > /dev/null; then
echo "No changes"
else
git commit -m 'Remove deleted asset files'
git pull --rebase
git push
fi
sync-site-repo-deleted:
runs-on: ubuntu-latest
needs: changed-gpmls
# only run if gpmls were deleted
if: ${{needs.changed-gpmls.outputs.deleted}}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: wikipathways-database
submodules: true
fetch-depth: 1
ref: main
- name: Checkout jekyll repo
uses: actions/checkout@v4
with:
repository: wikipathways/wikipathways.github.io
path: wikipathways.github.io
submodules: true
fetch-depth: 1
ref: main
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
- name: Set up ssh-agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.ACTIONS_DEPLOY_KEY }} ## for push into wp.gh.io rep
- name: Commit report
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
cd wikipathways.github.io
for f in ${{needs.changed-gpmls.outputs.deleted}}; do
wpid="$(basename ""$f"" | sed 's/.gpml//')"
echo "deleting $wpid from wikipathways.github.io"
if [ -e _pathways/"$wpid".md ]; then
git rm _pathways/"$wpid".md
fi
if [ -e _data/"$wpid"-bibliography.tsv ]; then
git rm _data/"$wpid"-bibliography.tsv
fi
if [ -e _data/"$wpid"-datanodes.tsv ]; then
git rm _data/"$wpid"-datanodes.tsv
fi
if [ -e assets/img/"$wpid"/"$wpid"-thumb.png ]; then
git rm assets/img/"$wpid"/"$wpid"-thumb.png
fi
done
if git diff --exit-code --staged > /dev/null; then
echo "No changes"
else
git commit -m 'Remove deleted tsv, md and png file(s)'
git pull --rebase
git push
fi