Add workflow for project page generation (combined with contributors) #23

Merged
mih merged 2 commits from msz/www.trr379.de:project-pages-workflow-2 into main 2026-02-25 11:54:01 +00:00
2 changed files with 36 additions and 30 deletions

View file

@ -1,16 +1,17 @@
name: Create publication pages name: Create contributor and project pages
on: on:
schedule: schedule:
- cron: '6 5 * * 1-5' - cron: '6 5 * * 1-5'
workflow_dispatch: workflow_dispatch:
env:
POOLAPI: https://pool.v0.trr379.de/api
jobs: jobs:
create_pages: create_pages:
runs-on: debian-latest runs-on: debian-latest
if: ${{ forgejo.repository == 'q04/www.trr379.de' }} if: ${{ forgejo.repository == 'q04/www.trr379.de' }}
outputs:
committed: ${{ steps.commit.outputs.committed }}
steps: steps:
- name: Checkout this - name: Checkout this
@ -58,21 +59,35 @@ jobs:
EOF EOF
echo OK echo OK
- name: Process metadata - name: Sync the env and prefetch some data
run: | run: |
cd ${{ steps.codecheckout.outputs.path }} cd ${{ steps.codecheckout.outputs.path }}
uv sync --locked uv sync
dtc read-pages https://pool.v0.trr379.de/api/public/records/p/TRR379Project > /tmp/projects.jsonl mkdir .cache
dtc read-pages https://pool.v0.trr379.de/api/public/records/p/TRR379Person \ dtc read-pages ${POOLAPI}/public/records/p/TRR379Project > .cache/projects.jsonl
| qrg inline-records --api-url https://pool.v0.trr379.de/api/ -c public -p delegated_by \ dtc get-records --pid "trr379root:." https://pool.v0.trr379.de/api/ public > .cache/trr379.jsonl
| uv run filters/join-association.py --inline --pop --field-name x_associated_projects - /tmp/projects.jsonl associated_with \
- name: Process contributors
run: |
cd ${{ steps.codecheckout.outputs.path }}
dtc read-pages ${POOLAPI}/public/records/p/TRR379Person \
| qrg inline-records --api-url ${POOLAPI}/ -c public -p delegated_by \
| uv run filters/join-association.py --inline --pop --field-name x_associated_projects - .cache/projects.jsonl associated_with \
| uv run filters/infer-site.py - ${{ steps.datacheckout.outputs.path }}/v2.2-2026-01-29-ror-data.parquet - \ | uv run filters/infer-site.py - ${{ steps.datacheckout.outputs.path }}/v2.2-2026-01-29-ror-data.parquet - \
| uv run person.py - ${{ steps.websitecheckout.outputs.path }}/content/contributors | uv run person.py - ${{ steps.websitecheckout.outputs.path }}/content/contributors
- name: Commit and push updates
id: commit
run: |
git add content/contributors git add content/contributors
git commit -m "Auto-update contributors" && result=t || result=nil git diff --quiet --cached && echo "Already up-to-date" || git commit -m "Auto-update contributors"
- name: Process projects
run: |
cd ${{ steps.codecheckout.outputs.path }}
cat .cache/projects.jsonl \
| qrg inline-records --api-url https://pool.v0.trr379.de/api/ -c public -p associated_with \
| uv run filters/join-association.py --field-name x_had_influence - .cache/trr379.jsonl influenced_by \
| uv run project.py - ${{ steps.websitecheckout.outputs.path }}/content/projects
git add content/projects
git diff --quiet --cached && echo "Already up-to-date" || git commit -m "Auto-update projects"
- name: Push updates
run: |
git push origin git push origin
echo "committed=${result}" >> $FORGEJO_OUTPUT

View file

@ -6,12 +6,13 @@ on:
- cron: '15 5 * * 1-5' - cron: '15 5 * * 1-5'
workflow_dispatch: workflow_dispatch:
env:
POOLAPI: https://pool.v0.trr379.de/api
jobs: jobs:
create_pages: create_pages:
runs-on: debian-latest runs-on: debian-latest
if: ${{ forgejo.repository == 'q04/www.trr379.de' }} if: ${{ forgejo.repository == 'q04/www.trr379.de' }}
outputs:
committed: ${{ steps.commit.outputs.committed }}
steps: steps:
- name: Checkout this - name: Checkout this
@ -57,9 +58,9 @@ jobs:
cd ${{ steps.codecheckout.outputs.path }} cd ${{ steps.codecheckout.outputs.path }}
uv sync uv sync
mkdir .cache mkdir .cache
dtc read-pages https://pool.v0.trr379.de/api/public/records/p/TRR379Person > .cache/Person.jsonl dtc read-pages ${POOLAPI}/public/records/p/TRR379Person > .cache/Person.jsonl
dtc read-pages https://pool.v0.trr379.de/api/public/records/p/TRR379Publication \ dtc read-pages ${POOLAPI}/public/records/p/TRR379Publication \
| qrg inline-records --api-url https://pool.v0.trr379.de/api/ -c public -p attributed_to \ | qrg inline-records --api-url ${POOLAPI}/ -c public -p attributed_to \
| uv run filters/enrich-via-doi.py --extras - .cache/Person.jsonl - \ | uv run filters/enrich-via-doi.py --extras - .cache/Person.jsonl - \
| uv run publication.py - ${{ steps.websitecheckout.outputs.path }}/content/publications | uv run publication.py - ${{ steps.websitecheckout.outputs.path }}/content/publications
@ -67,15 +68,5 @@ jobs:
id: commit id: commit
run: | run: |
git add content/publications git add content/publications
git commit -m "Auto-update publications" && result=t || result=nil git commit -m "Auto-update publications" || true
git push origin git push origin
echo "committed=${result}" >> $FORGEJO_OUTPUT
# deploy_created_pages:
# # pushes using automatic token don't trigger on-push jobs
# needs:
# - create_pages
# if: ${{ needs.create_pages.outputs.committed == 't' }}
# runs-on: trr379-hugo-site-build
# uses: ./.forgejo/workflows/deploy.yml