@@ -1,63 +1,23 @@
|
|||||||
name: Build LaTeX Document and Publish Release
|
name: "Build PDF"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ main ]
|
||||||
- main
|
pull_request:
|
||||||
workflow_dispatch: # Allows manual trigger
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-release:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/moderncv/debian-texlive-docker:main
|
||||||
steps:
|
steps:
|
||||||
# Check out the repository code
|
- name: Checkout code
|
||||||
- name: Checkout code
|
uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
- name: Build PDF
|
||||||
|
run: latexmk ./dokumentation.tex
|
||||||
# Set up LaTeX environment
|
- name: Upload PDF
|
||||||
- name: Set up LaTeX environment
|
uses: actions/upload-artifact@v3
|
||||||
run: sudo apt-get update && sudo apt-get install -y texlive-full
|
with:
|
||||||
|
name: dokumentation.pdf
|
||||||
# Compile the LaTeX document
|
path: ./dokumentation.pdf
|
||||||
- name: Compile LaTeX
|
|
||||||
run: |
|
|
||||||
cd latex
|
|
||||||
mkdir -p output
|
|
||||||
pdflatex -output-directory=output dokumentation.tex
|
|
||||||
# Replace `main.tex` with the name of your main LaTeX file
|
|
||||||
|
|
||||||
# Upload the PDF as an artifact (optional, for debugging)
|
|
||||||
- name: Upload PDF Artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: built-pdf
|
|
||||||
path: output/dokumentation.pdf
|
|
||||||
|
|
||||||
# Create a release in Gitea
|
|
||||||
- name: Create Gitea Release
|
|
||||||
id: create_release
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.TOKEN }}
|
|
||||||
run: |
|
|
||||||
curl -X POST \
|
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{"tag_name": "v1.0.0", "target_commitish": "main", "name": "LaTeX Build - v1.0.0", "body": "This release contains the compiled LaTeX document.", "draft": false, "prerelease": false}' \
|
|
||||||
https://git.out.jafre.li/api/v1/repos/jafreli/Laborarbeit-Projektmanagment/releases
|
|
||||||
|
|
||||||
# Upload the compiled PDF to the Gitea release
|
|
||||||
- name: Upload Release Asset
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.TOKEN }}
|
|
||||||
run: |
|
|
||||||
release_id=$(curl -s \
|
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
|
||||||
https://git.out.jafre.li/api/v1/repos/jafreli/Laborarbeit-Projektmanagment/releases \
|
|
||||||
| jq -r '.[0].id')
|
|
||||||
|
|
||||||
curl -X POST \
|
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
|
||||||
-F "name=dokumentation.pdf" \
|
|
||||||
-F "attachment=@output/dokumentation.pdf" \
|
|
||||||
https://git.out.jafre.li/api/v1/repos/jafreli/Laborarbeit-Projektmanagment/releases/$release_id/assets
|
|
||||||
Reference in New Issue
Block a user