Skip to content

Create main example

Create main example #5

Workflow file for this run

name: Create main example
on:
push:
branches:
- main
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * *'
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v3
with:
root_file: edengths.tex
args: "-pdfps -file-line-error -halt-on-error -interaction=nonstopmode"
- name: Test for modification
run: |
diff -I "%%*" edengths.ps .diff/edengths.ps && echo "action_state=red" >> $GITHUB_ENV || echo "action_state=green" >> $GITHUB_ENV
- name: Commit PS to main
run: |
cp edengths.ps .diff
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .diff/edengths.ps
git commit -m "Update PS"
if: env.action_state == 'green'
- name: Push changes to main
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
if: env.action_state == 'green'
- name: Commit PDF to gh-pages
run: |
mkdir build
mv edengths.pdf build
git fetch --all
git checkout --track origin/gh-pages
cp build/edengths.pdf .
git add ./edengths.pdf
git commit -m "Update PDF"
if: env.action_state == 'green'
- name: Push changes to gh-pages
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
if: env.action_state == 'green'