Skip to content

Commit

Permalink
will this actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
FacuDeLorenzo committed Aug 19, 2024
1 parent dc330af commit 0f8ed35
Show file tree
Hide file tree
Showing 8 changed files with 5,044 additions and 446 deletions.
52 changes: 32 additions & 20 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,42 @@ name: Convert Markdown with Mermaid to PDF
on:
push:
paths:
- '**/*.md'
- "**/*.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 markdown-it and markdown-it-mermaid
run: npm install markdown-it markdown-it-mermaid

- name: Convert Markdown to HTML
run: node convert-md-to-html.js

- name: Upload HTML file as an artifact
uses: actions/upload-artifact@v3
with:
name: html-file
path: cool-root-doc.html
- 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 }} | grep '\.md$'
- name: Process changed Markdown files
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.md$')
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"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.svg
*.pdf
node_modules
.vscode
21 changes: 0 additions & 21 deletions convert-md-to-html.js

This file was deleted.

Loading

0 comments on commit 0f8ed35

Please sign in to comment.