Skip to content

Commit

Permalink
build docs automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
oToToT committed Oct 20, 2023
1 parent 87bb3b6 commit 1121b12
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 48 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This is a basic workflow to help you get started with Actions

name: build docs.pdf

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
paths:
- 'docs/*.md'
- '.github/workflows/*'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
docs:
name: build docs.pdf and commit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
- name: Install md-to-pdf
run: npm i -g md-to-pdf
- name: Build PDF
run: |
bash -c "cd docs/ && printf \"---\\nscript:\\n - path: mathjax-config.js\\n - url: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js\\n---\\n\" | cat - Basic.md DataStructure.md FlowAndMatching.md Graph.md Math.md Geometry.md String.md Misc.md | md-to-pdf --launch-options '{ \"args\": [\"--no-sandbox\", \"--disable-setuid-sandbox\"] }' > docs.pdf"
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: auto build docs - ${{ github.sha }}
31 changes: 2 additions & 29 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@ on:
- 'pdf/codebook.pdf'
- 'README.md'
- '.editorconfig'
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
codebook:
name: build and commit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
Expand All @@ -35,26 +31,3 @@ jobs:
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: auto build codebook - ${{ github.sha }}

# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.ref }}
# release_name: Release ${{ github.ref }}
# draft: false
# prerelease: false

# - name: Upload Release Asset
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: pdf/codebook.pdf
# asset_name: codebook.pdf
# asset_content_type: application/pdf

10 changes: 0 additions & 10 deletions docs/Makefile

This file was deleted.

Binary file removed docs/docs.pdf
Binary file not shown.
10 changes: 10 additions & 0 deletions docs/mathjax-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
MathJax = {
tex: {
inlineMath: [
['$', '$'],
['\\(', '\\)'],
],
},
};

// https://unpkg.com/browse/mathjax/es5/tex-chtml.js
9 changes: 0 additions & 9 deletions docs/meta.yaml

This file was deleted.

0 comments on commit 1121b12

Please sign in to comment.