-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (36 loc) · 1.18 KB
/
pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Convert Markdown with Mermaid to PDF
on:
push:
paths:
- "**/*.md"
workflow_dispatch:
jobs:
convert_md_to_pdf:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Display changed Markdown files
run: |
echo "The following Markdown files were changed:"
git diff --name-only ${{ github.event.before }} ${{ github.sha }}
- name: Process changed Markdown files
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
for file in $CHANGED_FILES; do
FOLDER_NAME=$(basename $(dirname $file))
echo "Processing file $file in folder $FOLDER_NAME..."
mmdc -i $file -o $file # Override the same file
md-to-pdf $file # Convert the file to PDF
done
- name: Upload HTML file as an artifact
uses: actions/upload-artifact@v3
with:
name: pdf-files
path: "**/*.pdf"