Some checks failed
Build LaTeX Document and Publish Release / build-and-release (push) Failing after 5m51s
63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
name: Build LaTeX Document and Publish Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch: # Allows manual trigger
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
# Check out the repository code
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
# Set up LaTeX environment
|
|
- name: Set up LaTeX environment
|
|
run: sudo apt-get update && sudo apt-get install -y texlive-full
|
|
|
|
# Compile the LaTeX document
|
|
- name: Compile LaTeX
|
|
run: |
|
|
mkdir -p output
|
|
pdflatex -output-directory=output latex/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://<your-gitea-instance>/api/v1/repos/<owner>/<repo>/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://<your-gitea-instance>/api/v1/repos/<owner>/<repo>/releases \
|
|
| jq -r '.[0].id')
|
|
|
|
curl -X POST \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-F "name=dokumentation.pdf" \
|
|
-F "attachment=@output/dokumentation.pdf" \
|
|
https://<your-gitea-instance>/api/v1/repos/<owner>/<repo>/releases/$release_id/assets
|