-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.11 KB
/
convert-to-pdf.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Build PDF
on:
push:
branches: [main]
paths:
- 'docs/REPORT.md'
- 'docs/images/**'
- 'protocols/**.md'
jobs:
# First job: Update REPORT.md
update-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: '3.x' # Adjust as needed
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
# Install any dependencies if needed
- name: Generate Report
run: python scripts/create_report.py
- name: Commit and Push Updated Report
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git add docs/REPORT.md
git commit -m "Update REPORT.md with latest protocols" || echo "No changes to REPORT.md."
git push --force
# Second job: Convert REPORT.md to PDF
converttopdf:
name: Markdown to PDF
needs: update-report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Ensures the action can push back to the repository
persist-credentials: true
fetch-depth: 0 # Fetch all history for .Git based projects
# Configure Git
- name: Configure Git
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git pull
# Remove the old PDFs
- name: Remove Outdated PDFs
run: |
git rm -r pdfs
git commit -m "Remove existing pdfs folder"
git push --force
- uses: baileyjm02/[email protected]
with:
input_dir: docs
output_dir: pdfs
images_dir: docs/images
image_import: ./images
build_html: false
# Commit and Push
- name: Commit and Push PDF and HTML to main branch
run: |
git add pdfs/
git status
git commit -m "Automated commit of PDF and HTML files" -a || echo "No changes to commit."
git push --force