Add automatic release workflow with Marp-to-HTML and Markdown-to-PDF conversion#1
Add automatic release workflow with Marp-to-HTML and Markdown-to-PDF conversion#1
Conversation
…conversion Co-authored-by: rfaes <2385561+rfaes@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions workflow to automate GitHub Releases for workshop materials by converting markdown sources into publishable artifacts (Marp → HTML, other Markdown → PDF) and uploading them as release assets on version tag pushes.
Changes:
- Introduces
.github/workflows/release.ymltriggered byv*.*.*tag pushes. - Installs Marp CLI + Pandoc/TeX tooling and generates HTML/PDF artifacts into
dist/. - Creates a GitHub Release via
gh release createand attaches the generated artifacts.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| find . -name "slides.md" -type f | while read file; do | ||
| dir=$(dirname "$file" | sed 's|^\./||' | tr '/' '-') | ||
| output="dist/${dir}-slides.html" | ||
| echo "Converting $file -> $output" | ||
| marp "$file" --html --output "$output" |
There was a problem hiding this comment.
The Marp→HTML step only targets files named slides.md. Any markdown file with marp: true but a different filename would be skipped here and also skipped by the PDF step (because it filters on marp: true), resulting in missing release artifacts. Consider driving the HTML conversion off the same marp: true front-matter detection (or consolidating into a single loop that routes each .md file to Marp vs Pandoc).
| find . -name "slides.md" -type f | while read file; do | |
| dir=$(dirname "$file" | sed 's|^\./||' | tr '/' '-') | |
| output="dist/${dir}-slides.html" | |
| echo "Converting $file -> $output" | |
| marp "$file" --html --output "$output" | |
| find . -name "*.md" \ | |
| -not -path "./.github/*" \ | |
| -not -path "./node_modules/*" \ | |
| -type f | while read file; do | |
| if head -5 "$file" | grep -qE '^\s*marp:\s*true'; then | |
| name=$(echo "$file" | sed 's|^\./||' | tr '/' '-' | sed 's|\.md$||') | |
| output="dist/${name}.html" | |
| echo "Converting $file -> $output" | |
| marp "$file" --html --output "$output" | |
| fi |
| run: | | ||
| find . -name "slides.md" -type f | while read file; do | ||
| dir=$(dirname "$file" | sed 's|^\./||' | tr '/' '-') | ||
| output="dist/${dir}-slides.html" | ||
| echo "Converting $file -> $output" | ||
| marp "$file" --html --output "$output" | ||
| done | ||
|
|
||
| - name: Convert regular markdown files to PDF | ||
| run: | | ||
| find . -name "*.md" \ | ||
| -not -path "./.github/*" \ | ||
| -not -path "./node_modules/*" \ | ||
| -type f | while read file; do |
There was a problem hiding this comment.
Both conversion steps run find . ..., which will traverse the checked-out .git/ directory on the runner. That can add significant overhead and slow the workflow, especially when combined with per-file conversion. Prefer limiting the search to tracked markdown files (e.g., via git ls-files '*.md') or explicitly pruning .git (and dist) from the find traversal.
| artifacts=$(find dist -type f | sort) | ||
| if [ -z "$artifacts" ]; then | ||
| echo "No artifacts found in dist/. Skipping release creation." | ||
| exit 1 |
There was a problem hiding this comment.
This guard prints "Skipping release creation" but exits with status 1, which fails the workflow run for the tag push. If the intent is to skip creating a release when dist/ is empty, exit 0 (or use gh release create ... || handling) so the workflow doesn’t report a failure for a no-op release.
| exit 1 | |
| exit 0 |
…b Release behavior.
Adds a GitHub Actions release workflow that automatically converts workshop markdown files and publishes them as GitHub release assets when a version tag is pushed.
Description
Workshop materials (slides and docs) have no automated distribution mechanism. This adds a
release.ymlworkflow that converts files based on type — Marp presentations to HTML, all other markdown to PDF — and attaches them to a GitHub release.Detection logic:
marp: truefront matter (matched via^\s*marp:\s*true) → converted to HTML via@marp-team/marp-cli.mdfiles → converted to PDF viapandoc+xelatexOutput naming preserves directory structure encoded as hyphens:
part-1/slides.md→part-1-slides.htmlpart-1/03-pods/lab/instructions.md→part-1-03-pods-lab-instructions.pdfRelease creation uses
gh release createwith--generate-notesfor automatic changelog from commits.Type of Change
Related Issue
Changes Made
.github/workflows/release.ymltriggered onv*.*.*tag pushes@marp-team/marp-cli(Node 20) andpandoc+texlive-xetex+fonts-dejavuslides.mdfiles (Marp) to self-contained HTML.mdfiles (excluding.github/andnode_modules/) to PDF using GFM input + xelatexdist/; individual PDF failures are non-fatal warningsWorkshop Section Affected
Testing Done
make validate)make test)Test Results:
Documentation
Screenshots/Examples
Checklist
Additional Context
Requires no repository secrets beyond the default
GITHUB_TOKEN. The workflow usespermissions: contents: writescoped to the release job only.For Maintainers
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.