Skip to content

Add pull request test to actions workflows (nomencl) (#5) #1

Add pull request test to actions workflows (nomencl) (#5)

Add pull request test to actions workflows (nomencl) (#5) #1

name: Create nomencl example
on:
push:
branches:
- nomencl
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
with:
ref: nomencl
- 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"
pre_compile: |
pdflatex edengths
chmod 777 makenomencl.sh
./makenomencl.sh
- 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 nomencl
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 nomencl
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: nomencl
if: env.action_state == 'green'
- name: Commit PDF to gh-pages
run: |
mkdir build
mv edengths.pdf build
git fetch --all
git checkout -- ./makenomencl.sh
git checkout --track origin/gh-pages
cp build/edengths.pdf edengths_nomencl.pdf
git add ./edengths_nomencl.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'