diff --git a/.devcontainer.json b/.devcontainer/devcontainer.json similarity index 54% rename from .devcontainer.json rename to .devcontainer/devcontainer.json index 732ab66..5d62838 100644 --- a/.devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,33 +1,29 @@ -// -// (delete the above line to manage this file manually) +// This file was automatically generated with PreTeXt 2.34.0. +// If you modify this file, PreTeXt will no longer automatically update it. +// ////////////////////////////////////////////////////////////// // -// This file provides configuration options so that a PreTeXt +// This file provides configuration options so that a PreTeXt // project can be edited and built using GitHub's Codespaces. // It is recommended to keep this in your repository even if you -// do not use this feature, as it will allow other to explore -// your project easily. -// This file will be automatically generated by PreTeXt with the +// do not use this feature, as it will allow other to explore +// your project easily. +// This file will be automatically generated by PreTeXt with the // latest updates unless you remove the first comment line above. // /////////////////////////////////////////////////////////////// { - "name": "PreTeXt-Codespaces", - - // This Docker image includes some LaTeX support, but is still not to large. Note that if you keep your codespace running, it will use up your GitHub free storage quota. Additional options are listed below. - "image": "oscarlevin/pretext:small", - // If you need to generate more complicated assets (such as sageplots) or use additional fonts when building to PDF, comment out the above line and uncomment the following line. - // "image": "oscarlevin/pretext:full", - // If you only intend to build for web and don't have any latex-image generated assets, you can use a smaller image: - // "image": "oscarlevin/pretext:lite", + // "image": "pretextbook/pretext-full:1.6", // uses latest image from https://hub.docker.com/r/PreTeXtBook/pretext-full/tags + // If you don't need sagemath, you can use a smaller base image. Comment out the line above and uncomment the line below to use a smaller image. + "image": "pretextbook/pretext:1.6", + "features": {"ghcr.io/devcontainers/features/github-cli": {}}, - // Add gh cli as a feature (to support codechat) - "features": { - "ghcr.io/devcontainers/features/github-cli:1": {} - }, + // The pretext-full image above includes pretext, prefigure, and enough parts of latex and sagemath for most cases. Here we install additional dependencies. + "postCreateCommand": { + "install pandoc": "bash ./.devcontainer/installPandoc.sh", + "mark repo as safe": "git config --global --add safe.directory $(pwd)" + }, - // Respect the project's designated dependencies - "postCreateCommand": "pip install -r requirements.txt", // Port forwarding // --------------- @@ -60,28 +56,31 @@ } }, + // Configure tool-specific properties. "customizations": { "codespaces": { - "openFiles": ["source/main.ptx"] + "openFiles": ["README.md"] }, "vscode": { "settings": { "editor.quickSuggestions": { "other": "off" }, - "editor.snippetSuggestions": "top", - "xml.validation.enabled": false, + "editor.suggest.showProperties": false, + "editor.snippetSuggestions": "bottom", + "files.autoSave": "afterDelay", + "xml.validation.enabled": true, + "redhat.telemetry.enabled": false, "CodeChat.CodeChatServer.Command": "CodeChat_Server" }, "extensions": [ - "ms-vscode.live-server", "oscarlevin.pretext-tools", - "CodeChat.codechat" + "CodeChat.codechat", + "streetsidesoftware.code-spell-checker", + "alpinebuster.vscode-latex-table-editor", + "mathematic.vscode-pdf" ] } } - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" } diff --git a/.devcontainer/installPandoc.sh b/.devcontainer/installPandoc.sh new file mode 100644 index 0000000..e328b12 --- /dev/null +++ b/.devcontainer/installPandoc.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# This file was automatically generated with PreTeXt 2.34.0. +# If you modify this file, PreTeXt will no longer automatically update it. + +wget https://github.com/jgm/pandoc/releases/download/3.8.3/pandoc-3.8.3-1-amd64.deb -O pandoc.deb + +# wait for 60 second and then double check that no other script is using apt-get: +sleep 60 +while fuser /var/lib/dpkg/lock >/dev/null 2>&1; do + echo "Waiting for apt-get to be free..." + sleep 15 +done +# Install pandoc +apt-get install -y --no-install-recommends ./pandoc.deb + +rm pandoc.deb diff --git a/.github/workflows/pretext-cli.yml b/.github/workflows/pretext-cli.yml index 22b8a3c..733504d 100644 --- a/.github/workflows/pretext-cli.yml +++ b/.github/workflows/pretext-cli.yml @@ -1,21 +1,27 @@ -# -# (delete the above line to manage this file manually) - +# This file was automatically generated with PreTeXt 2.34.0. +# If you modify this file, PreTeXt will no longer automatically update it. +# +# This workflow file can be used to automatically build a project and create +# an artifact for deployment. It can also be used to deploy the project to +# GitHub Pages or Cloudflare Pages. +# +# The workflow is triggered on pull requests or can be run manually. You can uncomment +# the `push` event to have it run on pushes to the main branch as well. name: PreTeXt-CLI Actions on: # Runs on pull requests pull_request: branches: ["*"] - # Runs on pushes to main - push: - branches: ["main"] + ## Runs on pushes to main + #push: + # branches: ["main"] # Runs on demand workflow_dispatch: jobs: build: runs-on: ubuntu-latest - container: oscarlevin/pretext:full + container: oscarlevin/pretext-full steps: - name: Checkout source @@ -24,8 +30,26 @@ jobs: - name: install deps run: pip install -r requirements.txt + - name: set up node + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: install local ptx files + run: pretext --version + - name: build deploy targets - run: pretext build --deploys + run: | + version="$(pretext --version)" + major="$(echo $version | cut -d '.' -f 1)" + minor="$(echo $version | cut -d '.' -f 2)" + if [ "$major" -ge 2 -a "$minor" -ge 5 ]; then + echo "PreTeXt version is 2.5 or greater; using new build command" + pretext build --deploys + else + echo "PreTeXt version is less than 2.5, using old build command" + pretext build + fi - name: stage deployment run: pretext deploy --stage-only diff --git a/.github/workflows/pretext-deploy.yml b/.github/workflows/pretext-deploy.yml new file mode 100644 index 0000000..085d330 --- /dev/null +++ b/.github/workflows/pretext-deploy.yml @@ -0,0 +1,68 @@ +# This file was automatically generated with PreTeXt 2.34.0. +# If you modify this file, PreTeXt will no longer automatically update it. +# + +name: Build and Deploy +on: + # Currently, this workflow only runs when manually selected (the `workflow_dispatch` event). + # If you would like it to run on other events, uncomment some of the lines below. + + # # Runs on pull requests + # pull_request: + # branches: ["*"] + + # # Runs on pushes to main + # push: + # branches: ["main"] + + # # Runs every day at 00:00 UTC + # schedule: + # - cron: '0 0 * * *' + + # Runs on demand + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + container: oscarlevin/pretext-full + + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - name: set up node + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: add gh-cli + run: | + apt-get update + apt-get install gh jq -y + + - name: setup git config + run: | + git config --global --add safe.directory $(pwd) + git config user.name "${{ github.actor }} via GitHub Actions" + git config user.email "${{ github.actor }}@github_actions.no_reply" + + - name: install deps + run: pip install -r requirements.txt --break-system-packages + + - name: install local ptx files + run: pretext --version + + - name: build deploy targets + run: pretext build --deploys + + - name: run deploy + run: pretext deploy --no-push + + - name: push gh-pages branch + run: git push origin gh-pages --force + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 0096a4e..c68d800 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -# -# (delete the above line to manage this file manually) - +# This file was automatically generated with PreTeXt 2.34.0. +# If you modify this file, PreTeXt will no longer automatically update it. +# # Boilerplate list of files in a PreTeXt project for git to ignore # ensure this file is tracked !.gitignore @@ -11,6 +11,7 @@ published # don't track assets generated from source generated-assets +.cache # don't track the executables.ptx file executables.ptx @@ -90,6 +91,8 @@ bh_unicode_properties.cache # https://packagecontrol.io/packages/sublime-github GitHub.sublime-settings +# Don't track common virtual environment directories +venv/ # Don't include Dropbox settings and caches .dropbox diff --git a/requirements.txt b/requirements.txt index d53edfa..2289048 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -# -pretext == 2.5.2 +# This file was automatically generated with PreTeXt 2.34.0. +pretext == 2.34.0