Skip to content

Commit

Permalink
deploy using GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
xworld21 committed Oct 3, 2024
1 parent 78ddd06 commit e95b9ad
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 9 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish GitHub Pages
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract BookML
uses: docker://ghcr.io/vlmantova/bookml:latest
with:
args: update
- name: Compile
uses: docker://ghcr.io/vlmantova/bookml:latest
- name: Setup pages
uses: actions/configure-pages@v5
- name: upload outputs
uses: actions/upload-artifact@v4
with:
name: github-pages
path: '*.tar'
retention-days: 1
if-no-files-found: error
overwrite: true

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
27 changes: 20 additions & 7 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
SPLITAT=
LATEXMLPOSTEXTRAFLAGS=--timestamp=0

# default target
docs.tar:

include bookml/bookml.mk

%.tar: $$(AUX_DIR)/html/$$*/index.html $$(filter-out $$(AUX_DIR)/html/$$*/imsmanifest.xml,$$(filter-out $$(AUX_DIR)/html/$$*/LaTeXML.cache,$$(call bml.reclist.file,$$(AUX_DIR)/html/$$*)))
tar -cvf $@ --directory=$(AUX_DIR)/html/$* --exclude=./imsmanifest.xml --exclude=./LaTeXML.cache .

# custom rules to create plain style
# very hacky and not recommended until LaTeXML implements f:resource() or similar in XSLT
docs.zip: $(AUX_DIR)/html/docs/index.plain.html
docs.tar: $(AUX_DIR)/html/docs/index.plain.html

$(AUX_DIR)/xml/docs.plain.xml: docs.tex $(BOOKML_DEPS_XML) $(wildcard *.ltxml)
$(LATEXML) --preamble=literal:\\RequirePackage[style=plain]{bookml/bookml} \
--log="$(AUX_DIR)/latexmlaux/docs.plain.latexml.log" --destination="$@" "$<"
# build XML files
$(AUX_DIR)/xml/docs.plain.xml: docs.tex $(BOOKML_DEPS_XML) $(wildcard *.ltxml) docs.pdf | $(AUX_DIR)/latexmlaux $(AUX_DIR)/xml
@$(call bml.prog,latexml: $<$@)
@$(call bml.cmd,$(LATEXML) $(if $(call bml.grep,{bookml/bookml},$<),,--preamble=literal:\RequirePackage{bookml/bookml} \
) $(LATEXMLFLAGS) $(LATEXMLEXTRAFLAGS) --log="$(AUX_DIR)/latexmlaux/docs.plain.latexml.log" --destination="$@" "$<")

$(AUX_DIR)/html/docs/index.plain.html: $(AUX_DIR)/xml/docs.plain.xml $(BOOKML_DEPS_HTML) $(wildcard bmlimages/docs*.svg)
$(LATEXMLPOST) $(if $(wildcard LaTeXML-html5.xsl),,--stylesheet=bookml/XSLT/bookml-html5.xsl) \
--urlstyle=file --dbfile=$(AUX_DIR)/latexmlaux/docs.plain.LaTeXML.db --log="$(AUX_DIR)/latexmlaux/docs.plain.latexmlpost.log" \
--timestamp=0 --destination="$@" "$<"
$(AUX_DIR)/html/docs/index.plain.html: $$(AUX_DIR)/xml/docs.plain.xml $$(AUX_DIR)/html/docs/index.html $$(BOOKML_DEPS_HTML) $$(wildcard bmlimages/docs-*.svg) $$(wildcard bmlimages/docs/docs.dpth) bookml/search_index.pl bookml/XSLT/proc-text.xsl $$(if $$(filter $$@,$$(BMLGOALS)),,FORCE) | $$(AUX_DIR)/html
@$(eval _recurse:=$(if $(filter $@,$(BMLGOALS)),,yes))
+@$(if $(_recurse),$(MAKE) --no-print-directory -f $(firstword $(MAKEFILE_LIST)) "$@" "BMLGOALS=$@")
@$(if $(_recurse),,$(call bml.prog,latexmlpost: docs.plain.xml → docs/index.plain.html))
@$(if $(_recurse),,$(call bml.cmd,$(LATEXMLPOST) $(if $(wildcard LaTeXML-html5.xsl),,--stylesheet=bookml/XSLT/bookml-html5.xsl) \
$(if $(SPLITAT),--splitat=$(SPLITAT)) --xsltparameter=BMLSEARCH:yes $(LATEXMLPOSTFLAGS) $(LATEXMLPOSTEXTRAFLAGS) \
--dbfile=$(AUX_DIR)/latexmlaux/docs.plain.LaTeXML.db --log="$(AUX_DIR)/latexmlaux/docs.plain.latexmlpost.log" --destination="$@" "$<"))
2 changes: 1 addition & 1 deletion bookml
2 changes: 1 addition & 1 deletion docs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
\title{BookML\@: automated LaTeX to \href{https://bookdown.org/yihui/bookdown/html.html\#gitbook-style}{bookdown}-style HTML and SCORM, powered by \href{https://dlmf.nist.gov/LaTeXML/}{LaTeXML}}
\author{Vincenzo Mantova}

\date{21\textsuperscript{st} August 2024}
\date{3\textsuperscript{rd} October 2024}

\begin{document}

Expand Down

0 comments on commit e95b9ad

Please sign in to comment.