-
Notifications
You must be signed in to change notification settings - Fork 28
176 lines (152 loc) · 5.75 KB
/
pretext-cli.yml
File metadata and controls
176 lines (152 loc) · 5.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: PreTeXt-CLI Actions (TBIL Customization)
on:
# Runs on pull requests
pull_request:
branches: ["*"]
# Runs on pushes to main
push:
branches: ["main"]
# Runs on demand
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
runs-on: ubuntu-latest
container: oscarlevin/pretext-full
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup requirements
run: |
bash .devcontainer/setup.sh
bash scripts/download-cache.sh
git config --global --add safe.directory $(pwd)
- name: set up node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Build precalculus activities
run: |
pretext -v debug build -g precalculus-preview
- name: Build calculus activities
run: |
pretext -v debug build -g calculus-preview
- name: Build linear algebra activities
run: |
pretext -v debug build -g linear-algebra-preview
- name: Stage builds and updated cache
run: |
pretext deploy --stage-only
bash scripts/stage-cache.sh
- name: build and stage precalculus bank
run: |
python scripts/build_bank.py precalculus --full --stage
- name: build and stage calculus bank
run: |
python scripts/build_bank.py calculus --full --stage
- name: build and stage linear-algebra bank
run: |
python scripts/build_bank.py linear-algebra --full --stage
- name: Bundle output/stage as artifact
uses: actions/upload-artifact@v4
with:
name: deploy
path: output/stage
deploy-ghpages:
runs-on: ubuntu-latest
needs: build
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download website artifact
uses: actions/download-artifact@v4
with:
name: deploy
path: deploy
- name: Setup GitHub Pages
id: check
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: deploy
- name: Deploy to Github Pages
id: deployment
uses: actions/deploy-pages@v4
preview:
runs-on: ubuntu-latest
container: oscarlevin/pretext-full
if: github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
outputs:
markdown: ${{ steps.changes.outputs.markdown }}
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup requirements
run: |
bash .devcontainer/setup.sh
bash scripts/download-cache.sh
git config --global --add safe.directory $(pwd)
- name: set up node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: build previews of all changed files and stage
id: changes
run: |
python -m scripts.quickbuild_changes
pretext deploy --stage-only
- name: Bundle output/stage as artifact
uses: actions/upload-artifact@v4
with:
name: deploy
path: output/stage
deploy-cloudflare:
runs-on: ubuntu-latest
needs: preview
if: github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
permissions:
contents: read
deployments: write
pull-requests: write
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: deploy
path: deploy
- name: Create 404.html
run: echo "404 page not found" >> deploy/404.html
- name: Publish to Cloudflare
id: cloudflare_publish
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref || github.ref_name }}
directory: deploy
- name: Report preview link
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
script: |
cf_url = "${{ steps.cloudflare_publish.outputs.url }}"
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${{ needs.preview.outputs.markdown }}`
})