Manual Jekyll sync #14
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: Manual Jekyll sync | |
on: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: false # to allow multiple runs to queue up rather than clobber | |
jobs: | |
sync-site-repo-added-modified: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: wikipathways-database | |
submodules: true | |
fetch-depth: 0 | |
ref: main | |
- name: Checkout jekyll repo | |
uses: actions/checkout@v4 | |
with: | |
repository: wikipathways/wikipathways.github.io | |
path: wikipathways.github.io | |
submodules: true | |
fetch-depth: 0 | |
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 wikipathways-database/pathways/*/*.gpml; 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"/ || true | |
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 and md files' | |
git pull --rebase | |
git push | |
fi |