Skip to content

Commit 26631e7

Browse files
committed
Build iconfont with fontcustom on CI
1 parent 7084b75 commit 26631e7

File tree

2 files changed

+66
-3
lines changed

2 files changed

+66
-3
lines changed

.github/workflows/CI.yml

+52-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,29 @@ jobs:
4242
bundler-cache: true
4343
cache-version: 0 # Increment this number if you need to re-download cached gems.
4444

45+
- name: "Install fontcustom with all dependencies."
46+
working-directory: sources/iconfont
47+
run: ${{ github.workspace }}/.github/workflows/install-fontcustom.sh
48+
49+
- name: "Build iconfont."
50+
working-directory: sources/iconfont
51+
run: fontcustom compile
52+
53+
- name: "Upload 'iconfont' artifact."
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: 'iconfont'
57+
path: |
58+
_sass/_iconfont.scss
59+
assets/fonts/iconfont.eot
60+
assets/fonts/iconfont.svg
61+
assets/fonts/iconfont.ttf
62+
assets/fonts/iconfont.woff
63+
assets/fonts/iconfont.woff2
64+
sources/iconfont/.fontcustom-manifest.json
65+
sources/iconfont/iconfont-preview.html
66+
if-no-files-found: error
67+
4568
- name: "Setup Pages"
4669
id: pages
4770
uses: actions/configure-pages@v3
@@ -116,6 +139,16 @@ jobs:
116139
bundler-cache: true
117140
cache-version: 0 # Increment this number if you need to re-download cached gems.
118141

142+
- name: "Install fontcustom with all dependencies."
143+
if: steps.cache.outputs.cache-hit != 'true'
144+
working-directory: sources/iconfont
145+
run: ${{ github.workspace }}/.github/workflows/install-fontcustom.sh
146+
147+
- name: "Build iconfont"
148+
if: steps.cache.outputs.cache-hit != 'true'
149+
working-directory: sources/iconfont
150+
run: fontcustom compile
151+
119152
- name: "Retrieve GitHub Pages configuration."
120153
if: steps.cache.outputs.cache-hit != 'true'
121154
id: pages
@@ -162,6 +195,15 @@ jobs:
162195
name: 'github-pages-base'
163196
path: github-pages-base
164197

198+
- name: "Prepare base for diffing."
199+
working-directory: github-pages-base
200+
run: |
201+
rm assets/fonts/iconfont.eot
202+
rm assets/fonts/iconfont.svg
203+
rm assets/fonts/iconfont.ttf
204+
rm assets/fonts/iconfont.woff
205+
rm assets/fonts/iconfont.woff2
206+
165207
- name: "Download just-built artifact."
166208
uses: actions/download-artifact@v3
167209
with:
@@ -170,8 +212,15 @@ jobs:
170212

171213
- name: "Prepare head for diffing."
172214
working-directory: github-pages-head
173-
# This is not a normal artifact. It was produced by actions/upload-pages-artifact and has only a tar file inside.
174-
run: tar -xf artifact.tar && rm artifact.tar
175-
215+
run: |
216+
# This is not a normal artifact. It was produced by actions/upload-pages-artifact and has only a tar file inside.
217+
tar -xf artifact.tar && rm artifact.tar
218+
rm assets/fonts/iconfont.eot
219+
rm assets/fonts/iconfont.svg
220+
rm assets/fonts/iconfont.ttf
221+
rm assets/fonts/iconfont.woff
222+
rm assets/fonts/iconfont.woff2
223+
224+
# assets/fonts/ is excluded, because building fonts is not deterministic.
176225
- name: "Diff head against base."
177226
run: diff --recursive github-pages-base github-pages-head
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
mkdir -p fontcustom && cd fontcustom
2+
gem install fontcustom --version 2.0.0
3+
sudo apt-get install fontforge=1:20201107~dfsg-4build1
4+
git clone --branch v1.3.1 --depth 1 https://github.com/bramstein/sfnt2woff-zopfli.git \
5+
&& pushd sfnt2woff-zopfli \
6+
&& make \
7+
&& mv sfnt2woff-zopfli sfnt2woff \
8+
&& echo "${PWD}" >> "${GITHUB_PATH}" \
9+
&& popd
10+
git clone --branch v1.0.2 --depth 1 --recursive https://github.com/google/woff2.git \
11+
&& pushd woff2 \
12+
&& make clean all \
13+
&& echo "${PWD}" >> "${GITHUB_PATH}" \
14+
&& popd

0 commit comments

Comments
 (0)