Skip to content

Commit 060ae95

Browse files
committed
add deploy action that uses pretext deploy.
1 parent f17b449 commit 060ae95

3 files changed

Lines changed: 75 additions & 3 deletions

File tree

pretext/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
"devcontainer.json": Path(".devcontainer/devcontainer.json"),
230230
"requirements.txt": Path("requirements.txt"),
231231
"pretext-cli.yml": Path(".github", "workflows", "pretext-cli.yml"),
232+
"deploy.yml": Path(".github", "workflows", "deploy.yml"),
232233
"installPretext.sh": Path(".devcontainer", "installPretext.sh"),
233234
"installPandoc.sh": Path(".devcontainer", "installPandoc.sh"),
234235
"installLatex.sh": Path(".devcontainer", "installLatex.sh"),
@@ -244,6 +245,7 @@
244245
GIT_RESOURCES = [
245246
".gitignore",
246247
"pretext-cli.yml",
248+
"deploy.yml",
247249
"devcontainer.json",
248250
"installPretext.sh",
249251
"installPandoc.sh",

templates/deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# This file was automatically generated with PreTeXt 2.16.1.
2+
# If you modify this file, PreTeXt will no longer automatically update it.
3+
#
4+
5+
name: Build and Deploy
6+
on:
7+
# Currently, this workflow only runs when manually selected (the `workflow_dispatch` event).
8+
# If you would like it to run on other events, uncomment some of the lines below.
9+
10+
# # Runs on pull requests
11+
# pull_request:
12+
# branches: ["*"]
13+
14+
# # Runs on pushes to main
15+
# push:
16+
# branches: ["main"]
17+
18+
# # Runs every day at 00:00 UTC
19+
# schedule:
20+
# - cron: '0 0 * * *'
21+
22+
# Runs on demand
23+
workflow_dispatch:
24+
25+
permissions:
26+
contents: write
27+
28+
jobs:
29+
build-and-deploy:
30+
runs-on: ubuntu-latest
31+
container: oscarlevin/pretext:small
32+
33+
steps:
34+
- name: Checkout source
35+
uses: actions/checkout@v4
36+
37+
- name: add gh-cli
38+
run: |
39+
apt-get update
40+
apt-get install gh jq -y
41+
42+
- name: setup git config
43+
run: |
44+
git config --global --add safe.directory $(pwd)
45+
git config user.name "${{ github.actor }} via GitHub Actions"
46+
git config user.email "${{ github.actor }}@github_actions.no_reply"
47+
48+
- name: install deps
49+
run: pip install -r requirements.txt --break-system-packages
50+
51+
- name: install local ptx files
52+
run: pretext --version
53+
54+
- name: build deploy targets
55+
run: pretext build --deploys
56+
57+
- name: run deploy
58+
run: pretext deploy --no-push
59+
60+
- name: push gh-pages branch
61+
run: git push origin gh-pages --force
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+

templates/pretext-cli.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# This file was automatically generated with PreTeXt 2.16.1.
22
# If you modify this file, PreTeXt will no longer automatically update it.
33
#
4+
# This workflow file can be used to automatically build a project and create
5+
# an artifact for deployment. It can also be used to deploy the project to
6+
# GitHub Pages or Cloudflare Pages.
7+
#
8+
# The workflow is triggered on pull requests or can be run manually. You can uncomment
9+
# the `push` event to have it run on pushes to the main branch as well.
410
name: PreTeXt-CLI Actions
511
on:
612
# Runs on pull requests
713
pull_request:
814
branches: ["*"]
9-
# Runs on pushes to main
10-
push:
11-
branches: ["main"]
15+
## Runs on pushes to main
16+
#push:
17+
# branches: ["main"]
1218
# Runs on demand
1319
workflow_dispatch:
1420

0 commit comments

Comments
 (0)