-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.48 KB
/
render-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
name: Render Markdown to PDF
on:
push:
branches:
- main
jobs:
render:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies (Pandoc)
run: |
sudo apt-get update
sudo apt-get install -y \
pandoc \
texlive-latex-base \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-fonts-extra \
- name: Get last commit info
id: vars
run: |
VERSION=$(cat version.txt)
echo "VERSION=$VERSION" >> $GITHUB_ENV
COMMIT_HASH=$(git log -1 --pretty=format:'%H')
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_ENV
COMMIT_DATE=$(git log -1 --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%ad')
echo "COMMIT_DATE=$COMMIT_DATE" >> $GITHUB_ENV
- name: Increment version number
run: |
NEW_VERSION=$(echo "$VERSION + 0.1" | bc)
echo "$NEW_VERSION" > version.txt
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Replace placeholders in markdown
run: |
sed -i "s/{{ version }}/$VERSION/g" roar-data-privacy-and-information-security-manual.md
sed -i "s/{{ commit }}/$COMMIT_HASH/g" roar-data-privacy-and-information-security-manual.md
sed -i "s/{{ commit_date }}/$COMMIT_DATE/g" roar-data-privacy-and-information-security-manual.md
sed -i "s/{{ version }}/$VERSION/g" roar-sdlc.md
sed -i "s/{{ commit }}/$COMMIT_HASH/g" roar-sdlc.md
sed -i "s/{{ commit_date }}/$COMMIT_DATE/g" roar-sdlc.md
sed -i "s/{{ version }}/$VERSION/g" roar-bcdr.md
sed -i "s/{{ commit }}/$COMMIT_HASH/g" roar-bcdr.md
sed -i "s/{{ commit_date }}/$COMMIT_DATE/g" roar-bcdr.md
- name: Convert Markdown to PDF
run: |
make infosec
make sldc
make bcdr
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add version.txt
git add roar-data-privacy-and-information-security-manual.pdf -f
git add roar-sdlc.pdf -f
git add roar-bcdr.pdf -f
git commit -m "Updated version $VERSION and rendered PDF from commit $COMMIT_HASH"
git push origin main