Process GPML changes #738
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |