Compile tex #66
Workflow file for this run
This file contains 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: Compile tex | |
on: | |
workflow_dispatch: | |
inputs: | |
directory-sorgente: | |
description: 'Directory file sorgente' | |
required: true | |
directory-destinazione: | |
description: 'Directory destinazione pdf' | |
required: true | |
nome-pdf: | |
description: 'Nome del pdf da creare' | |
required: true | |
directory-glossario: | |
description: 'Directory files glossario' | |
required: true | |
elimina-sorgenti: | |
description: 'Elimina i file sorgenti' | |
type: boolean | |
required: true | |
default: false | |
jobs: | |
compile: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Run gloss.py | |
run: python actions/gloss.py ${{ inputs.directory-sorgente }} | |
env: | |
GLOSSARIO_PATH: ${{ inputs.directory-glossario }} | |
CURRENT_DIRECTORY: ${{ inputs.directory-sorgente }} | |
- name: Commit and push changes | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
git add '*.tex' | |
git commit -m "Glossified .tex" | |
git push origin HEAD:${{ github.ref }} | |
working-directory: ${{ inputs.directory-sorgente }} | |
- name: Run script | |
id: script-runned | |
run: python actions/script.py -f "${{ inputs.directory-sorgente }}/main.tex" -a "${{ github.actor}}" -r "" -c "Approvazione documento" --approve | |
- name: Compile | |
uses: xu-cheng/latex-action@v3 | |
with: | |
root_file: main.tex | |
working_directory: ${{ inputs.directory-sorgente }} | |
latexmk_use_lualatex: true | |
- name: Commit and push changes | |
run: | | |
mv ${{ inputs.directory-sorgente }}/main.pdf ${{ inputs.directory-destinazione }}/${{ inputs.nome-pdf }}.pdf | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
if [ ${{ inputs.elimina-sorgenti }} == true ]; then | |
rm -r ${{ inputs.directory-sorgente }} | |
git add -A | |
else | |
git add '*.pdf' '*.tex' | |
fi | |
git commit -m "Creato file .pdf" | |
git remote set-url origin https://${{ github.token }}@github.com/${{ github.repository }} | |
git push | |