Try to fix workflows #22
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
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 |