Skip to content

Commit

Permalink
first attempt at pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Lichtman committed Apr 15, 2024
1 parent 73bb471 commit 7b7858c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/generate_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build docs and deploy static content to Pages

on:
push:
branches: ["json_schema"] # TODO CHANGE TO MAIN ONCE PIPELINE WORKS

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:


permissions:
contents: read
pages: write
id-token: write # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install prereqs
run: apt install python3-pip pandoc inkscape -y
- name: Pip installs
run: pip install pylatex
- name: Build docs
run: python3 docs-generator.py
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '.' # Upload entire repository, TODO ONLY UPLOAD THE HTML AND PDF
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ sigmf-spec.pdf
sigmf-spec.out
sigmf-spec.log
sigmf-spec.aux
svg-inkscape/
svg-inkscape/
sigmf-spec.html
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The main pdf is generated using the following content:
1. `collection-schema.json` - Collection object documentation
1. `additional_content.md` - mix of plaintext/markdown/latex for the remaining sections of the document

The script `pdf-generator.py` uses Python, PyLaTeX, and Inkscape to create the specifications document in pdf and html formats.
The script `docs-generator.py` uses Python, PyLaTeX, Pandoc, and Inkscape to create the specifications document in PDF and HTML formats.

## Frequently Asked Questions

Expand Down
5 changes: 5 additions & 0 deletions pdf-generator.py → docs-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
print("SigMF Version: " + sigmf_version)

def add_code_tags(text): # swaps every pair of ` ` for \code{}
text = text.replace('_', '\\_') # need to escape underscores when inside a command
while text.find('`') != -1:
text = text.replace('`', '\\code{', 1)
text = text.replace('`', '}', 1)
Expand Down Expand Up @@ -159,3 +160,7 @@ def gen_fields(doc, d):
doc.generate_pdf('sigmf-spec', clean_tex=False, compiler_args=['--shell-escape']) # clean_tex will remove the generated tex file
except subprocess.CalledProcessError as e:
print(e) # this seems normal to occur

# Generate HTML
css_url = "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
subprocess.run(f"pandoc sigmf-spec.tex -f latex -t html -s -o sigmf-spec.html --toc --toc-depth=3 -c {css_url}".split())

0 comments on commit 7b7858c

Please sign in to comment.