Skip to content

Commit 821c506

Browse files
Update to PreTeXt project source.
1 parent 740bbe1 commit 821c506

1 file changed

Lines changed: 108 additions & 99 deletions

File tree

.github/workflows/pretext-cli.yml

Lines changed: 108 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -2,105 +2,114 @@
22
# (delete the above line to manage this file manually)
33

44
name: PreTeXt-CLI Actions
5+
56
on:
6-
# Runs on pull requests
7-
pull_request:
8-
branches: ["*"]
9-
# Runs on pushes to main
10-
push:
11-
branches: ["main"]
12-
# Runs on demand
13-
workflow_dispatch:
7+
# Runs on pull requests
8+
pull_request:
9+
branches: ["*"]
10+
11+
# Runs on pushes to main
12+
push:
13+
branches: ["main"]
14+
15+
# Runs on demand
16+
workflow_dispatch:
1417

1518
jobs:
16-
build:
17-
runs-on: ubuntu-latest
18-
container: oscarlevin/pretext:full
19-
20-
steps:
21-
- name: Checkout source
22-
uses: actions/checkout@v4
23-
24-
- name: install deps
25-
run: pip install -r requirements.txt
26-
27-
- name: install local ptx files
28-
run: pretext --version
29-
30-
- name: build deploy targets
31-
run: |
32-
version="$(pretext --version)"
33-
major="$(echo $version | cut -d '.' -f 1)"
34-
minor="$(echo $version | cut -d '.' -f 2)"
35-
if [ "$major" -ge 2 -a "$minor" -ge 5 ]; then
36-
echo "PreTeXt version is 2.5 or greater; using new build command"
37-
pretext build --deploys
38-
else
39-
echo "PreTeXt version is less than 2.5, using old build command"
40-
pretext build
41-
fi
42-
- name: stage deployment
43-
run: pretext deploy --stage-only
44-
45-
- name: Bundle output/stage as artifact
46-
uses: actions/upload-artifact@v4
47-
with:
48-
name: deploy
49-
path: output/stage
50-
51-
deploy-cloudflare:
52-
runs-on: ubuntu-latest
53-
needs: build
54-
if: vars.CLOUDFLARE_PROJECT_NAME != ''
55-
permissions:
56-
contents: read
57-
deployments: write
58-
59-
steps:
60-
- name: Download artifact
61-
uses: actions/download-artifact@v4
62-
with:
63-
name: deploy
64-
path: deploy
65-
- name: Create 404.html
66-
run: echo "404 page not found" >> deploy/404.html
67-
- name: Publish to Cloudflare
68-
uses: cloudflare/pages-action@v1
69-
with:
70-
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
71-
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
72-
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
73-
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
74-
branch: ${{ github.head_ref || github.ref_name }}
75-
directory: deploy
76-
77-
deploy-ghpages:
78-
runs-on: ubuntu-latest
79-
needs: build
80-
if: vars.PTX_ENABLE_DEPLOY_GHPAGES == 'yes' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
81-
permissions:
82-
contents: read
83-
pages: write
84-
id-token: write
85-
concurrency:
86-
group: "page"
87-
cancel-in-progress: false
88-
environment:
89-
name: github-pages
90-
url: ${{ steps.deployment.outputs.page_url }}
91-
steps:
92-
- name: Download website artifact
93-
uses: actions/download-artifact@v4
94-
with:
95-
name: deploy
96-
path: deploy
97-
- name: Setup GitHub Pages
98-
id: check
99-
uses: actions/configure-pages@v4
100-
- name: Upload artifact
101-
uses: actions/upload-pages-artifact@v3
102-
with:
103-
path: deploy
104-
- name: Deploy to Github Pages
105-
id: deployment
106-
uses: actions/deploy-pages@v4
19+
build:
20+
runs-on: ubuntu-latest
21+
container: oscarlevin/pretext:full
22+
23+
steps:
24+
- name: Checkout source
25+
uses: actions/checkout@v4
26+
27+
- name: install deps
28+
run: pip install -r requirements.txt
29+
30+
- name: install local ptx files
31+
run: pretext --version
32+
33+
- name: build deploy targets
34+
run: |
35+
version="$(pretext --version)"
36+
major="$(echo $version | cut -d '.' -f 1)"
37+
minor="$(echo $version | cut -d '.' -f 2)"
38+
if [ "$major" -ge 2 -a "$minor" -ge 5 ]; then
39+
echo "PreTeXt version is 2.5 or greater; using new build command"
40+
pretext build --deploys
41+
else
42+
echo "PreTeXt version is less than 2.5, using old build command"
43+
pretext build
44+
fi
45+
46+
- name: stage deployment
47+
run: pretext deploy --stage-only
48+
49+
- name: Bundle output/stage as artifact
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: deploy
53+
path: output/stage
54+
55+
deploy-cloudflare:
56+
runs-on: ubuntu-latest
57+
needs: build
58+
if: vars.CLOUDFLARE_PROJECT_NAME != ''
59+
permissions:
60+
contents: read
61+
deployments: write
62+
63+
steps:
64+
- name: Download artifact
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: deploy
68+
path: deploy
69+
70+
- name: Create 404.html
71+
run: echo "404 page not found" >> deploy/404.html
72+
73+
- name: Publish to Cloudflare
74+
uses: cloudflare/pages-action@v1
75+
with:
76+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
77+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
78+
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
79+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
80+
branch: ${{ github.head_ref || github.ref_name }}
81+
directory: deploy
82+
83+
deploy-ghpages:
84+
runs-on: ubuntu-latest
85+
needs: build
86+
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
87+
permissions:
88+
contents: read
89+
pages: write
90+
id-token: write
91+
concurrency:
92+
group: "page"
93+
cancel-in-progress: false
94+
environment:
95+
name: github-pages
96+
url: ${{ steps.deployment.outputs.page_url }}
97+
steps:
98+
- name: Download website artifact
99+
uses: actions/download-artifact@v4
100+
with:
101+
name: deploy
102+
path: deploy
103+
104+
- name: Setup GitHub Pages
105+
id: check
106+
uses: actions/configure-pages@v4
107+
108+
- name: Upload artifact
109+
uses: actions/upload-pages-artifact@v3
110+
with:
111+
path: deploy
112+
113+
- name: Deploy to Github Pages
114+
id: deployment
115+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)