add: 2024-autumn-exercise/adhoc.md #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: md-to-pages | |
concurrency: md-to-pages | |
on: | |
push: | |
branches: [ main ] | |
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: Check if slides folder exists | |
id: slides-folder-exists | |
run: bash -c "[[ -d slides ]] ; echo \"has_slides=\$?\" >> \"$GITHUB_OUTPUT\"" | |
- name: Marp Build (slides folder, if exists) | |
if: steps.slides-folder-exists.outputs.has_slides == '0' | |
uses: docker://marpteam/marp-cli:v3.0.2 | |
with: | |
args: -I slides/ -o build/slides/ | |
env: | |
MARP_USER: root:root | |
- 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/ |