003: adding draft #17
This file contains hidden or 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: 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 |