-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7a7bdb
commit ccd7e1e
Showing
3 changed files
with
114 additions
and
39 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
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/html/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/html/index.html \ | ||
build/pdf/rendeiro-lab_manual.pdf | ||
- name: Upload Pages artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: build/html | ||
|
||
- name: Add CNAME for custom domain | ||
run: echo "manual.rendeiro.group" > build/html/CNAME | ||
|
||
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 |
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
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