Some checks failed
Build LaTeX Document / build_latex (push) Failing after 2m11s
58 lines
2.4 KiB
YAML
58 lines
2.4 KiB
YAML
name: Build LaTeX Document
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
env:
|
|
TEX_NAME: Tesi.tex
|
|
PDF_NAME: Tesi.pdf
|
|
|
|
jobs:
|
|
build_latex:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up Git repository
|
|
uses: actions/checkout@v4.2.2
|
|
|
|
- name: Install MiKTeX
|
|
run: |
|
|
curl -fsSL https://miktex.org/download/key | tee /usr/share/keyrings/miktex-keyring.asc > /dev/null
|
|
echo "deb [signed-by=/usr/share/keyrings/miktex-keyring.asc] https://miktex.org/download/ubuntu jammy universe" | sudo tee /etc/apt/sources.list.d/miktex.list
|
|
apt-get update
|
|
apt-get install miktex -y
|
|
miktexsetup --shared=yes finish
|
|
|
|
- name: Update MiKTeX package database
|
|
run: miktex packages update-package-database && miktex packages update
|
|
|
|
- name: Enable automatic package installation
|
|
run: initexmf --set-config-value=[MPM]AutoInstall=yes
|
|
|
|
- name: Build LaTeX document
|
|
run: |
|
|
pdflatex -interaction=nonstopmode -halt-on-error ${{ env.TEX_NAME }} || (cat /root/.miktex/texmfs/data/miktex/log/pdflatex.log && exit 1)
|
|
|
|
- name: Check for PDF artifact
|
|
run: file ${{ env.PDF_NAME }} || grep -q ' PDF '
|
|
|
|
- name: Delete latest release attachment for Tesi.pdf
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
run: |
|
|
latest_release_id=$(curl -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" https://gitea.kobim.cloud/repos/${{ github.repository_owner }}/${{ github.repository }}/releases/tags/latest | jq -r '.id')
|
|
assets=$(curl -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" https://gitea.kobim.cloud/repos/${{ github.repository_owner }}/${{ github.repository }}/releases/$latest_release_id/assets | jq -r '.[] | select(.name == "${{ env.PDF_NAME }}") | .id')
|
|
for asset_id in $assets; do
|
|
curl -X DELETE -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" https://gitea.kobim.cloud/repos/${{ github.repository }}/releases/assets/$asset_id
|
|
done
|
|
|
|
- name: Release PDF artifact
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: ${{ env.PDF_NAME }}
|
|
tag_name: latest
|
|
body: |
|
|
PDF document built from latest LaTeX source.
|
|
token: ${{ secrets.RELEASE_TOKEN }} |