Files
Denkweisen-Workshop/.gitea/workflows/publish-presentation.yml
T
Mikula Lajos 0b24cdbe14
Build and Publish Slides / build-and-publish (push) Successful in 1m18s
Fixed action2
2026-11-16 13:17:14 +01:00

88 lines
2.6 KiB
YAML

name: Build and Publish Slides
on:
push:
branches:
- master
workflow_dispatch:
permissions:
contents: read
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install Google Chrome
run: |
sudo apt-get update
sudo apt-get install -y wget
wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
-O /tmp/google-chrome.deb
sudo apt-get install -y /tmp/google-chrome.deb
- name: Build PDF and HTML
env:
CHROME_PATH: /usr/bin/google-chrome
run: |
mkdir -p dist
npx --yes @marp-team/marp-cli@latest \
--pdf slides.md -o dist/slides.pdf
npx --yes @marp-team/marp-cli@latest \
--html slides.md -o dist/slides.html
- name: Create Gitea release
id: release
env:
BASE_URL: ${{ secrets.TARGET_BASE_URL }}
OWNER: ${{ secrets.TARGET_OWNER }}
REPO: ${{ secrets.TARGET_REPO }}
TOKEN: ${{ secrets.TARGET_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
API="${BASE_URL%/}/api/v1/repos/${OWNER}/${REPO}"
RESPONSE=$(curl --fail-with-body --silent --show-error \
-X POST "$API/releases" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n \
--arg tag "$TAG" \
--arg name "Slides $TAG" \
'{tag_name:$tag,name:$name,draft:false}')")
echo "release_id=$(echo "$RESPONSE" | jq -r '.id')" \
>> "$GITHUB_OUTPUT"
- name: Upload slides to Gitea release
env:
BASE_URL: ${{ secrets.TARGET_BASE_URL }}
OWNER: ${{ secrets.TARGET_OWNER }}
REPO: ${{ secrets.TARGET_REPO }}
TOKEN: ${{ secrets.TARGET_TOKEN }}
RELEASE_ID: ${{ steps.release.outputs.release_id }}
run: |
set -euo pipefail
API="${BASE_URL%/}/api/v1/repos/${OWNER}/${REPO}"
for file in dist/*; do
curl --fail-with-body --silent --show-error \
-X POST \
"$API/releases/$RELEASE_ID/assets?name=$(basename "$file")" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$file"
done