Apply suggestions from code review #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
| # Converts latex acronym format to a rough markdown template for easier viewing | |
| name: Markdown / Latex Acronym Workflow | |
| on: | |
| push: | |
| branches-ignore: | |
| - main # Ignore when items are pushed to main / README.md gets updated before then | |
| pull_request: | |
| types: [opened, reopened, edited, synchronize] | |
| workflow_dispatch: | |
| # Runs script and uploads new version if in main for markdown output | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Action | |
| uses: actions/checkout@v4 | |
| - name: Import Libraries | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y texlive-base texlive-latex-base texlive-latex-extra texlive-xetex texlive-fonts-recommended texlive-fonts-extra texlive-lang-greek | |
| - name: Run Markdown Script | |
| run: | | |
| rm -f uasal-acronyms.md | |
| python utilities/latex_acronyms-to-markdown.py | |
| - name: Upload Markdown Artifact | |
| uses: actions/upload-artifact@v4 | |
| # Upload even if it fails to better see issues | |
| if: always() | |
| with: | |
| name: Markdown-Acronyms | |
| path: uasal-acronyms.md | |
| - name: Run LaTeX Script | |
| run: bash compile.sh | |
| - name: Upload LaTeX Artifact | |
| uses: actions/upload-artifact@v4 | |
| # Upload even if it fails to better see issues | |
| if: always() | |
| with: | |
| name: Latex-Acronyms-PDF | |
| path: compiled-acronyms.pdf | |
| - name: Extract branch name | |
| shell: bash | |
| run: echo "branch_name=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | |
| - name: Update README.md | |
| if: ${{ github.ref != 'refs/heads/main' && github.event_name != 'pull_request' }} | |
| run: | | |
| git fetch # fetch branches | |
| git config --global user.name 'GitHub Action' | |
| git config --global user.email '[email protected]' | |
| git add README.md | |
| git diff-index --quiet HEAD || git commit -m "Updating README.md for markdown adjustments" # commit to the repository (ignore if no modification) | |
| git push # push to remote branch | |
| - name: Update Compiled Branch | |
| if: ${{ github.ref == 'refs/heads/main'}} | |
| run: | | |
| git fetch origin compiled --recurse-submodules=no | |
| git config --global user.name 'GitHub Action' | |
| git config --global user.email '[email protected]' | |
| git branch --track compiled origin/compiled | |
| mkdir output | |
| git worktree add output compiled | |
| mv uasal-acronyms.md output/uasal-acronyms.md | |
| mv compiled-acronyms.pdf output/compiled-acronyms.pdf | |
| cd output | |
| git add . | |
| git commit -m "Compiled documents created w/CI on main" | |
| git push |