-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alberto Merino Risueño
authored and
Alberto Merino Risueño
committed
Nov 8, 2024
1 parent
edc800a
commit 1ce8adf
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
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 imgs ]]; then cp -R imgs build/imgs; fi | ||
|
||
- name: Marp Build (README) | ||
uses: docker://marpteam/marp-cli:v3.0.2 | ||
with: | ||
args: --theme rose-pine.css slices.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: --theme rose-pine.css slices.md --allow-local-files -o build/slices.pdf | ||
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/ | ||
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: Deploy production | ||
if: ${{ github.event_name == 'push' }} | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: ./build/ | ||
clean-exclude: pr-preview/ | ||
|
||
|