Initial commit
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
name: Build and Publish Slides
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
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: Build PDF and HTML
|
||||
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
|
||||
Reference in New Issue
Block a user