Skip to content

Add two slide decks #44

Add two slide decks

Add two slide decks #44

Workflow file for this run

name: marp-to-pages
concurrency: marp-to-pages
on:
push:
branches: [ main ]
pull_request:
types:
- opened
- reopened
- synchronize
- closed
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Ensure build dir exists
run: mkdir -p build
- name: Copy images directory (if exists)
run: if [[ -d img ]]; then cp -R img build/img; fi
- name: Marp Build (README)
uses: docker://marpteam/marp-cli:v3.0.2
with:
args: README.md -o build/index.html
env:
MARP_USER: root:root
- name: Marp Build (README.pdf)
uses: docker://marpteam/marp-cli:v3.0.2
with:
args: README.md --allow-local-files -o build/README.pdf
env:
MARP_USER: root:root
- name: Marp Build (README.pptx)
uses: docker://marpteam/marp-cli:v3.0.2
with:
args: README.md --allow-local-files -o build/README.pptx
env:
MARP_USER: root:root
- name: Check if docs folder exists
id: docs-folder-exists
run: bash -c "[[ -d docs ]] ; echo \"has_docs=\$?\" >> \"$GITHUB_OUTPUT\""
- name: Marp Build (docs folder, if exists)
if: steps.docs-folder-exists.outputs.has_docs == '0'
uses: docker://marpteam/marp-cli:v3.0.2
with:
args: -I docs/ -o build/docs/ --pdf
env:
MARP_USER: root:root
- name: Deploy preview
if: ${{ github.event_name == 'pull_request' }}
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./build/
preview-branch: gh-pages
umbrella-dir: pr-preview
- name: Clean up old previews
if: ${{ github.event_name == 'push' }}
run: |
# Fetch all branches and tags to ensure the checkout is up-to-date
git fetch --prune --unshallow
# Check out the gh-pages branch
git checkout gh-pages
# List all directories in the pr-preview folder
previews=$(ls pr-preview)
# Find the most recent directory (assuming they are timestamped or lexicographically ordered)
latest_preview=$(echo "$previews" | sort | tail -n 1)
# Remove all but the latest preview directory
for preview in $previews; do
if [[ "$preview" != "$latest_preview" ]]; then
echo "Removing old preview: $preview"
rm -rf "pr-preview/$preview"
fi
done
# Commit and push the changes
git commit -am "Clean up old preview folders"
git push origin gh-pages
- name: Deploy production
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: ./build/
clean-exclude: pr-preview/