diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml new file mode 100644 index 0000000..bcb6f71 --- /dev/null +++ b/.forgejo/workflows/publish.yaml @@ -0,0 +1,26 @@ +on: [push] +jobs: + test_checkout: + runs-on: docker + container: + image: ghcr.io/typst/typst:v0.13.1 + steps: + - run: apk add --no-cache git curl + - run: | + mkdir -p ~/.local/share/typst/packages/local/template-thesis-matisse/ + git clone https://git.mineau.eu/histausse/template-thesis-matisse.git ~/.local/share/typst/packages/local/template-thesis-matisse/0.0.1 + - run: | + TOKEN=$(echo -n "x-access-token:${GITHUB_TOKEN}" | base64) + mkdir -p "${GITHUB_WORKSPACE}" + cd "${GITHUB_WORKSPACE}" + git init + git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" + git -c http.extraHeader="Authorization: Basic ${TOKEN}" fetch origin "${GITHUB_SHA}" + git checkout "${GITHUB_SHA}" + ls + - run: | + cd "${GITHUB_WORKSPACE}" + /bin/typst compile --input commit=$(git rev-parse --short HEAD) main.typ + - run: | + curl --user "histausse:${GITHUB_TOKEN}" -X DELETE "${GITHUB_SERVER_URL}/api/packages/histausse/generic/thesis/latest/draft.pdf" + curl --user "histausse:${GITHUB_TOKEN}" --upload-file "${GITHUB_WORKSPACE}/main.pdf" "${GITHUB_SERVER_URL}/api/packages/histausse/generic/thesis/latest/draft.pdf" diff --git a/README.md b/README.md new file mode 100644 index 0000000..4c7f7f9 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Thesis Manuscript + +By Jean-Marie Mineau, supervised by Jean-François Lalande and Valérie Viet Triem Tong, at CentraleSupélec, campus Rennes. + +## Build + +Currently build on [typst](https://github.com/typst/typst) 0.13.1. + +To build, you need to install the template: https://git.mineau.eu/histausse/template-thesis-matisse + +``` +mkdir -p ~/.local/share/typst/packages/local/template-thesis-matisse/ +git clone https://git.mineau.eu/histausse/template-thesis-matisse.git ~/.local/share/typst/packages/local/template-thesis-matisse/0.0.1 +``` + +Alternatively, for easier access to the template: + +``` +mkdir -p ~/.local/share/typst/packages/local/template-thesis-matisse/ +git clone https://git.mineau.eu/histausse/template-thesis-matisse.git +ln -s $(pwd)/template-thesis-matisse ~/.local/share/typst/packages/local/template-thesis-matisse/0.0.1 +``` + +Then to build the manuscript: + +``` +typst compile main.typ +``` + +Additionally, the argument `--input commit=$(git rev-parse --short HEAD)` will add the current commit at the beginning of the draft, and `--input draft=false` will build the clean version, without TODOs or line numbers. diff --git a/main.typ b/main.typ index 2e4f3b4..d2136fd 100644 --- a/main.typ +++ b/main.typ @@ -4,6 +4,16 @@ #import "abstract.typ": keywords-en, keywords-fr, abstract-en, abstract-fr #import "0_preamble/notations.typ": * +#let draft = if "draft" in sys.inputs { + assert( + sys.inputs.draft == "true" or sys.inputs.draft == "false", + message: "If --input draft= is set, must be 'true', or 'false'" + ) + sys.inputs.draft == "true" +} else { + true +} + #show: matisse-thesis.with( title-fr: todo[Find a title], title-en: todo[Find a title], @@ -17,7 +27,7 @@ keywords-fr: keywords-fr, abstract-en: abstract-en, abstract-fr: abstract-fr, - draft: true, + draft: draft, ) // Preamble