Skip to content

Workflow file for this run

name: marp-and-mkdocs-to-pages
concurrency: marp-and-mkdocs-to-pages
on:
push:
branches: [ main ]
paths:
- slides/**
- docs/**
- mkdocs.yml
- img/**
- .github/workflows/publish-pages.yml
workflow_dispatch:
branches: [main]
permissions:
contents: write
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code ✅
uses: actions/checkout@v4
- name: Set variables for Mkdocs Macros ℹ️
run: |
echo "---" > docs/assets/data/github.yml
echo "org_name: ${{ github.repository_owner }}" >> docs/assets/data/github.yml
echo "repo_name: ${{ github.event.repository.name }}" >> docs/assets/data/github.yml
echo "repository: ${{ github.repository }}" >> docs/assets/data/github.yml
- name: Replace URLs to match git repo ✂️
run: |
grep -rl 'https://.*.github.io/one-click-se-demos/' . --exclude-dir .git | xargs sed -i 's/https:\/\/.*.github.io\/one-click-se-demos/https:\/\/'"${{ github.repository_owner }}"'.github.io\/one-click-se-demos/g'
grep -rl 'https://github.com/.*/one-click-se-demos' . --exclude-dir .git | xargs sed -i 's/https:\/\/github.com\/.*\/one-click-se-demos/https:\/\/github.com\/'"${{ github.repository_owner }}"'\/one-click-se-demos/g'
grep -rl '{{gh.repo_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.repo_name}}/'"${{ github.repository_owner }}"'/g'
grep -rl '{{gh.org_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.org_name}}/'"${{ github.repository_owner }}"'/g'
- name: Setup Python3 🐍
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build MkDocs Site
run: |
pip install mkdocs-material
pip install mkdocs-macros-plugin
mkdocs build
- name: Build Directories and Copy images 🖼️
run: |
mkdir site/slides \
&& mkdir site/pdfs \
&& cp -R slides/img site/slides/img
- name: Build HTML from Marp 🔨
uses: docker://marpteam/marp-cli:v3.4.0
with:
args: --theme-set ./themes/ --html --input-dir slides/ -o site/slides/
env:
MARP_USER: root:root
- name: Build PDF from marp_slides.md 🔨
uses: docker://marpteam/marp-cli:v3.4.0
with:
args: --theme-set ./themes/ --html --pdf --allow-local-files --input-dir slides/ -o site/pdfs/
env:
MARP_USER: root:root
# - name: setup node.js 🏗️
# uses: actions/setup-node@v4
# with:
# node-version: 18
# - name: install gzipper and compress files 🖥️
# run: |
# npm init -y
# npm i gzipper -g
# gzipper compress --include htm,html,css,js,svg,xml,map,json,img,png,jpg,jpeg --zopfli --brotli --remove-larger ./site/
- name: Setup Pages 📖
uses: actions/configure-pages@v5
- name: Upload artifact 🔼
uses: actions/upload-pages-artifact@v3
with:
path: ./site/
- name: Deploy to GitHub Pages 🚀
id: deployment
uses: actions/deploy-pages@v4
# - name: Deploy production 🚀
# if: ${{ github.event_name == 'push' }}
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# branch: gh-pages
# folder: ./site/