-
Notifications
You must be signed in to change notification settings - Fork 34
161 lines (129 loc) · 4.62 KB
/
on-pull-request.yml
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
name: Build Textbook
on:
push:
branches: ["master", "main"]
pull_request:
branches: ["master", "main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run makedist.sh in Docker container
run: |
cd ./ci
./prepare-for-ci.sh
docker compose up -d
docker compose exec -T ibllinearalgebra ./makedist.sh
docker compose down
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: textbook
path: ci/dist/
- name: Verifies all PDFs were built
run: |
cd ./ci
./verify-all-compiled.sh
pretext_conversion:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Run prepare-for-pretext-conversion.sh
run: |
cd ./ci
./prepare-for-pretext-conversion.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: textbook-pretext
path: ci/book-pretext/pretext-output
pretext_build:
runs-on: ubuntu-latest
needs: pretext_conversion
# Run in the pretext docker container
container:
image: oscarlevin/pretext:small
steps:
- name: Echo pretext version
run: pretext support
# fetch the `textbook-pretext` artifact and unzip it
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: textbook-pretext
path: ci/book-pretext/pretext-output
# Build the book
- name: Build pretext book
run: |
cd ci/book-pretext/pretext-output
pretext build web
# List files in the output directory
- name: List files in output directory
run: ls -shR ci/book-pretext/pretext-output/output/web
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: textbook-pretext-output
path: ci/book-pretext/pretext-output/output/web
build_website:
runs-on: ubuntu-latest
# needs pretext_build and build jobs to finish
needs: [pretext_build, build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download textbook PDFs
uses: actions/download-artifact@v4
with:
name: textbook
path: website/landing-page/assets/nightly-pdf
- name: Download pretext website
uses: actions/download-artifact@v4
with:
name: textbook-pretext-output
path: website/landing-page/assets/textbook
- name: Copy prebuilt files to website
run: |
mkdir -p website/landing-page/assets/pdf
cp ./dist/*.pdf ./website/landing-page/assets/pdf/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: website
path: website/landing-page
deploy_to_github_pages:
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
needs: build_website
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download website artifact
uses: actions/download-artifact@v4
with:
name: website
path: website
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./website"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4