-
Notifications
You must be signed in to change notification settings - Fork 0
318 lines (305 loc) · 10.6 KB
/
build.yaml
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
name: Build font and specimen
on: push
permissions:
contents: write
jobs:
build:
name: Build font
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install sys tools/deps
run: |
sudo apt-get update
sudo apt-get install ttfautohint
sudo snap install yq
- uses: actions/cache@v4
with:
path: ./venv/
key: ${{ runner.os }}-venv-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-
# If a new release is cut, use the release tag to auto-bump the source files
# - name: Bump release
# if: github.event_name == 'release'
# run: |
# . venv/bin/activate
# SRCS=$(yq e ".sources[]" sources/config.yaml)
# TAG_NAME=${GITHUB_REF/refs\/tags\//}
# echo "Bumping $SRCS to $TAG_NAME"
# for src in $SRCS
# do
# bumpfontversion sources/$src --new-version $TAG_NAME;
# done
- name: Build font
run: make build
- name: Generate zip filename
id: zip-name
shell: bash
# Set the archive name to repo name + "-fonts" e.g "MavenPro-fonts"
run: echo "FONTS_ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-fonts" >> $GITHUB_ENV
- name: Archive built fonts
uses: actions/upload-artifact@v4
with:
name: ${{ env.FONTS_ZIP_NAME }}
path: fonts/
outputs:
FONTS_ZIP_NAME: ${{ env.FONTS_ZIP_NAME }}
test-fontbakery:
name: Check with FontBakery
needs: build
runs-on: ubuntu-latest
env:
FONTS_ZIP_NAME: ${{ needs.build.outputs.FONTS_ZIP_NAME }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/cache@v4
with:
path: ./venv-test/
key: ${{ runner.os }}-venv-test-${{ hashFiles('requirements-test.txt') }}
restore-keys: |
${{ runner.os }}-venv-test-
- name: Download font
uses: actions/download-artifact@v4
with:
name: ${{ env.FONTS_ZIP_NAME }}
path: fonts/
- name: Check with FontBakery
# For this job, pretend that there's an updated venv in addition to build.stamp
run: mkdir venv && touch venv/touchfile && touch build.stamp && make test
continue-on-error: true
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: site-fontbakery
path: out/
retention-days: 1
test-fontvalidator:
name: Check with Font Validator
needs: build
runs-on: ubuntu-latest
env:
FONTS_ZIP_NAME: ${{ needs.build.outputs.FONTS_ZIP_NAME }}
steps:
- uses: actions/checkout@v4
- name: Download font
uses: actions/download-artifact@v4
with:
name: ${{ env.FONTS_ZIP_NAME }}
path: fonts/
- name: Check with FontValidator
# For this job, pretend that there's an updated venv in addition to build.stamp
run: mkdir venv && touch venv/touchfile && touch build.stamp && make fv-test
continue-on-error: true
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: site-fontvalidator
path: out/
retention-days: 1
test-diffs-jonova:
name: Generate diffs (Jonova)
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
FONTS_ZIP_NAME: ${{ needs.build.outputs.FONTS_ZIP_NAME }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/cache@v4
with:
path: ./venv/
key: ${{ runner.os }}-venv-${{ hashFiles('requirements.txt') }}
- uses: actions/cache@v4
with:
path: ./jonova-2.032/
key: jonova-2.032
- name: Download font
uses: actions/download-artifact@v4
with:
name: ${{ env.FONTS_ZIP_NAME }}
path: fonts/
- name: Generate diffs
run: touch build.stamp && make diff-jonova
continue-on-error: true
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: site-diffs-jonova-${{ runner.os }}
path: out/
retention-days: 1
test-diffs-jonova-condensed:
name: Generate diffs (Jonova Condensed)
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
FONTS_ZIP_NAME: ${{ needs.build.outputs.FONTS_ZIP_NAME }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/cache@v4
with:
path: ./venv/
key: ${{ runner.os }}-venv-${{ hashFiles('requirements.txt') }}
- uses: actions/cache@v4
with:
path: ./jonova-2.032/
key: jonova-2.032
- name: Download font
uses: actions/download-artifact@v4
with:
name: ${{ env.FONTS_ZIP_NAME }}
path: fonts/
- name: Generate diffs
run: touch build.stamp && make diff-jonova-condensed
continue-on-error: true
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: site-diffs-jonova-condensed-${{ runner.os }}
path: out/
retention-days: 1
generate-samples:
name: Generate samples
needs: build
runs-on: ubuntu-latest
env:
FONTS_ZIP_NAME: ${{ needs.build.outputs.FONTS_ZIP_NAME }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/cache@v4
with:
path: ./venv/
key: ${{ runner.os }}-venv-${{ hashFiles('requirements.txt') }}
- name: Download font
uses: actions/download-artifact@v4
with:
name: ${{ env.FONTS_ZIP_NAME }}
path: fonts/
- name: Generate samples
run: |
touch build.stamp
make images
mkdir -p out/samples
cp documentation/*.png out/samples
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: site-images
path: out/
retention-days: 1
deploy-site:
name: Deploy website
needs:
- test-fontbakery
- test-fontvalidator
- test-diffs-jonova
- test-diffs-jonova-condensed
- generate-samples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: site-*
path: out/
merge-multiple: true
- name: Copy site index
run: cp scripts/index.html out/index.html
- name: Append image lists to Diffenator2 report homepages
run: |
cd out/proof/Jonova
echo "<h3>Debug images</h3>" >> diffenator2-report.html
find imgs/ -type f -printf "<p><a href='%h/%f'>%f</a></p>\n" >> diffenator2-report.html
cd ../JonovaCondensed
echo "<h3>Debug images</h3>" >> diffenator2-report.html
find imgs/ -type f -printf "<p><a href='%h/%f'>%f</a></p>\n" >> diffenator2-report.html
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
- name: Generate zip filename
id: zip-name
shell: bash
# Set the archive name to repo name + "-site" e.g "MavenPro-site"
run: echo "SITE_ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-site" >> $GITHUB_ENV
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.SITE_ZIP_NAME }}
path: out/
outputs:
SITE_ZIP_NAME: ${{ env.SITE_ZIP_NAME }}
# There are two ways a release can be created: either by pushing a tag, or by
# creating a release from the GitHub UI. Pushing a tag does not automatically
# create a release, so we have to do that ourselves. However, creating a
# release from the GitHub UI *does* push a tag, and we don't want to create
# a new release in that case because one already exists!
release:
name: Create and populate release
needs: build
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/')
env:
FONTS_ZIP_NAME: ${{ needs.build.outputs.FONTS_ZIP_NAME }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Download font artefact files
uses: actions/download-artifact@v4
with:
name: ${{ env.FONTS_ZIP_NAME }}
path: ${{ env.FONTS_ZIP_NAME }}
# - name: Copy DESCRIPTION.en_us.html to artefact directory
# run: cp documentation/DESCRIPTION.en_us.html ${{ env.FONTS_ZIP_NAME }}/DESCRIPTION.en_us.html
# - name: Copy ARTICLE.en_us.html to artefact directory
# run: cp documentation/ARTICLE.en_us.html ${{ env.FONTS_ZIP_NAME }}/ARTICLE.en_us.html
# continue-on-error: true
- name: Copy OFL.txt to artefact directory
run: cp OFL.txt ${{ env.FONTS_ZIP_NAME }}/OFL.txt
# - name: Remove proof/fontbakery stuff from release
# run: rm -rf ${{ env.FONTS_ZIP_NAME }}/out
- name: gen release file name
shell: bash
run: echo "RELEASE_FONTS_ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-${{github.ref_name}}" >> $GITHUB_ENV
- name: Create release bundle
run: mv ${{ env.FONTS_ZIP_NAME }} ${{ env.RELEASE_FONTS_ZIP_NAME }}; zip -r ${{ env.RELEASE_FONTS_ZIP_NAME }}.zip ${{ env.RELEASE_FONTS_ZIP_NAME }}
- name: Check for release
id: create_release
run: |
if ! gh release view ${{ github.ref_name }}; then
git show -s --format=%B ${{ github.ref_name }} | tail -n +4 | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F -
fi
- name: Populate release
run: |
gh release upload ${{ github.ref_name }} ${{ env.RELEASE_FONTS_ZIP_NAME }}.zip --clobber
- name: Set release live
run: |
gh release edit ${{ github.ref_name }} --draft=false