better styling of HTML #15
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: Build Lab Manual | |
on: | |
push: | |
branches: | |
- "*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pandoc wkhtmltopdf xfonts-75dpi | |
python3 -m pip install --user pipx | |
python3 -m pipx ensurepath | |
pipx install mdformat | |
pipx inject mdformat mdformat-gfm | |
- name: Set version in metadata.yaml | |
run: | | |
VERSION=$(git describe --tags --always --dirty || echo "dev") | |
sed -i -e "s/<VERSION>/$VERSION/g" metadata.yaml | |
- name: Create ORDER file | |
run: | | |
echo "README.md source/getting_started.md source/mission_statement.md source/code_of_conduct.md source/communication_and_meetings.md source/infrastructure.md source/project_planning.md source/research.md source/record_keeping.md source/learning.md source/manuscript_writing.md source/offboarding.md CHANGELOG.md" > ORDER | |
- name: Format markdown files | |
run: | | |
find source -type f -name "*.md" | xargs mdformat | |
- name: Add modifications to files | |
run: | | |
readarray -t ORDER < ORDER | |
echo ${ORDER[@]:0:12} | xargs sed -i -e '$a\\n' | |
echo ${ORDER[@]:0:12} | xargs sed -i -e '$a<div style="page-break-after: always;"></div>' | |
- name: Convert to HTML | |
run: | | |
mkdir -p build/{html,pdf} | |
cat ORDER | xargs pandoc \ | |
-V toc-title='Table of contents' \ | |
--embed-resources \ | |
--standalone \ | |
--css=assets/style.css \ | |
--toc \ | |
--toc-depth 1 \ | |
-t html5 \ | |
--metadata-file=metadata.yaml \ | |
-o build/index.html | |
- name: Add container div | |
run: | | |
sed 's/<body>/<body><div class="container">/g' -i build/index.html | |
sed 's/<\/body>/<\/div><\/body>/g' -i build/index.html | |
- name: Convert to PDF | |
run: | | |
wkhtmltopdf \ | |
--enable-internal-links \ | |
--enable-local-file-access \ | |
--header-center "Rendeiro lab manual" \ | |
--header-font-size 8 \ | |
--footer-center "[page]/[topage]" \ | |
--footer-font-size 8 \ | |
build/index.html \ | |
build/lab-manual.pdf | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: build | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |