Skip to content

003: adding draft

003: adding draft #17

Workflow file for this run

name: Build and publish
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-book:
runs-on: ubuntu-latest
steps:
- name: Set up repository
uses: actions/checkout@v6
with:
path: repo
- name: Compile articles
uses: xu-cheng/latex-action@v4
with:
working_directory: repo/briefs
root_file: "*.tex"
- name: Upload to autogen repository
run: |
# Clone tools repository (it has the script)
git clone https://github.com/assumptionsofphysics/tools tools
# Clone autogen repository
git clone https://gcarcassi:${{ secrets.AUTOGEN_TOKEN }}@github.com/assumptionsofphysics/autogen autogen
ls -R
# Run the script
python tools/problem-scraper/technicalBriefIndex.py autogen/briefs/briefs.json repo/briefs/*.tex
cd repo
find . -type f -iname '*.pdf' -print0 | rsync -0a --files-from=- --remove-source-files ./ ../autogen/
cd ../autogen
ls -R
git add '**/*.pdf'
git add 'briefs/briefs.json'
# Commit and push only if there were changes
if ! git diff --cached --quiet; then
git config user.name "gcarcassi[bot]"
git config user.email "gabriele.carcassi@gmail.com"
git pull
git commit -m "Updating community articles"
git push
else
echo "No changes to commit."
fi