Add workflow for generating project pages #22

Closed
msz wants to merge 2 commits from msz/www.trr379.de:project-pages-workflow into main
3 changed files with 86 additions and 25 deletions

View file

@ -1,16 +1,17 @@
name: Create publication pages
name: Create contributor pages
on:
schedule:
- cron: '6 5 * * 1-5'
workflow_dispatch:
env:
POOLAPI: https://pool.v0.trr379.de/api
jobs:
create_pages:
runs-on: debian-latest
if: ${{ forgejo.repository == 'q04/www.trr379.de' }}
outputs:
committed: ${{ steps.commit.outputs.committed }}
steps:
- name: Checkout this
@ -62,10 +63,11 @@ jobs:
run: |
cd ${{ steps.codecheckout.outputs.path }}
uv sync --locked
dtc read-pages https://pool.v0.trr379.de/api/public/records/p/TRR379Project > /tmp/projects.jsonl
dtc read-pages https://pool.v0.trr379.de/api/public/records/p/TRR379Person \
| qrg inline-records --api-url https://pool.v0.trr379.de/api/ -c public -p delegated_by \
| uv run filters/join-association.py --inline --pop --field-name x_associated_projects - /tmp/projects.jsonl associated_with \
mkdir .cache
dtc read-pages ${POOLAPI}/public/records/p/TRR379Project > .cache/projects.jsonl
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 person.py - ${{ steps.websitecheckout.outputs.path }}/content/contributors
@ -73,6 +75,5 @@ jobs:
id: commit
run: |
git add content/contributors
git commit -m "Auto-update contributors" && result=t || result=nil
git commit -m "Auto-update contributors" || true
git push origin
echo "committed=${result}" >> $FORGEJO_OUTPUT

View file

@ -0,0 +1,69 @@
name: Create project pages
on:
schedule:
- cron: '24 5 * * 1-5'
workflow_dispatch:
env:
POOLAPI: https://pool.v0.trr379.de/api
jobs:
create_pages:
runs-on: debian-latest
if: ${{ forgejo.repository == 'q04/www.trr379.de' }}
steps:
- name: Checkout this
id: websitecheckout
uses: https://hub.datalad.org/forgejo/datalad-clone-action@v1
with:
ref: main
get_file_content: false
recursive: false
- name: Checkout code
id: codecheckout
uses: https://hub.datalad.org/forgejo/datalad-clone-action@v1
with:
repository: q02/pool-publication-page
get_file_content: false
path: code
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install qrg & dtc suites
run: |
uv tool install https://hub.psychoinformatics.de/datalink/query-rse-group.git
uv tool install dump-things-pyclient
- name: Configure Git
run: |
git config --global user.name "Forgejo Actions"
git config --global user.email "forgejo-actions@hub.trr379.de"
git config --global credential.helper cache
git credential approve <<EOF
url=${{ forgejo.server_url }}
username=${{ forgejo.actor }}
password=${{ forgejo.token }}
EOF
echo OK
- name: Process metadata
run: |
cd ${{ steps.codecheckout.outputs.path }}
uv sync
mkdir .cache
dtc get-records --pid "trr379root:." https://pool.v0.trr379.de/api/ public > .cache/trr379.jsonl
dtc read-pages https://pool.v0.trr379.de/api/public/records/p/TRR379Project \
| 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
- name: Commit and push updates
id: commit
run: |
git add content/projects
git commit -m "Auto-update projects" || true
git push origin

View file

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