Skip to content

Commit 57edecd

Browse files
authored
fix(generator): fix iconfont generator, update workflows (#15)
- [x] install woff2, eot-utils and wget before generating the iconfont; - [x] revise github workflows - configure concurrency;
1 parent 1ca5cd1 commit 57edecd

File tree

4 files changed

+56
-16
lines changed

4 files changed

+56
-16
lines changed

.github/workflows/trunk-on-push.yml renamed to .github/workflows/trunk.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
22

3-
name: trunk-on-push
3+
name: trunk
44

55
on:
66
push:
@@ -10,14 +10,14 @@ defaults:
1010
run:
1111
shell: bash
1212

13+
concurrency:
14+
group: ${{ github.ref_name }}.${{ github.sha }}.trunk
15+
cancel-in-progress: true
16+
1317
jobs:
1418
test-build-deploy:
1519
runs-on: ubuntu-latest
1620

17-
strategy:
18-
matrix:
19-
node-version: [16.x]
20-
2121
steps:
2222
- name: Don't save Bash session history
2323
run: unset HISTFILE
@@ -35,10 +35,10 @@ jobs:
3535
shelltools:
3636
- 'src/*.sh'
3737
38-
- name: Use Node.js ${{ matrix.node-version }}
38+
- name: Use Node.js 16.x
3939
uses: actions/setup-node@v3
4040
with:
41-
node-version: ${{ matrix.node-version }}
41+
node-version: 16.x
4242
check-latest: true
4343

4444
- name: Get variables (publish)

.github/workflows/pr-validation.yml renamed to .github/workflows/validate-pr.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
22

3-
name: pr-validation
3+
name: validate-pr
44

55
on:
66
pull_request:
@@ -10,14 +10,14 @@ defaults:
1010
run:
1111
shell: bash
1212

13+
concurrency:
14+
group: ${{ github.head_ref }}.${{ github.sha }}.validate-pr
15+
cancel-in-progress: true
16+
1317
jobs:
1418
premerge:
1519
runs-on: ubuntu-latest
1620

17-
strategy:
18-
matrix:
19-
node-version: [16.x]
20-
2121
steps:
2222
- name: Don't save Bash session history
2323
run: unset HISTFILE
@@ -36,10 +36,10 @@ jobs:
3636
shelltools:
3737
- 'src/*.sh'
3838
39-
- name: Use Node.js ${{ matrix.node-version }}
39+
- name: Use Node.js 16.x
4040
uses: actions/setup-node@v3
4141
with:
42-
node-version: ${{ matrix.node-version }}
42+
node-version: 16.x
4343
check-latest: true
4444

4545
- name: Lint shell

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "material-design-icon-fonts-self-hosted-web",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "Self-hosted version generator of Google Material Design icon fonts for web apps.",
55
"keywords": [
66
"icons",

src/generate-iconfont.sh

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ MATERIAL_ICONS_TWOTONE_REGULAR_EOT_LOCAL_SRC="./src/MaterialIconsTwoTone-Regular
2929
MATERIAL_ICONS_TWOTONE_REGULAR_TTF_LOCAL_SRC="./src/MaterialIconsTwoTone-Regular.ttf"
3030
MATERIAL_ICONS_TWOTONE_REGULAR_WOFF2_DIST="./iconfont/MaterialIconsTwoTone-Regular.woff2"
3131

32+
##
33+
# Checks if a deb package is installed.
34+
##
35+
checkIfDebPackageIsInstalled() {
36+
local PACKAGE_EXISTS
37+
PACKAGE_EXISTS=$(dpkg -s "$1")
38+
echo "${PACKAGE_EXISTS}"
39+
}
40+
3241
##
3342
# Installs packages:
3443
# - eot-utils (https://manpages.debian.org/stretch/eot-utils/)
@@ -37,7 +46,37 @@ MATERIAL_ICONS_TWOTONE_REGULAR_WOFF2_DIST="./iconfont/MaterialIconsTwoTone-Regul
3746
# - wget (https://www.gnu.org/software/wget/)
3847
##
3948
installTools() {
40-
sudo apt install woff2 eot-utils wget
49+
# sudo apt install -y woff2 eot-utils wget
50+
51+
local WOFF2_EXISTS
52+
WOFF2_EXISTS=$(checkIfDebPackageIsInstalled woff2)
53+
if [ -z "${WOFF2_EXISTS}" ]; then
54+
echo "woff2 is not installed. Installing the package..."
55+
56+
sudo apt install -y woff2
57+
else
58+
echo "woff2 is already installed."
59+
fi
60+
61+
local EOT_UTILS_EXISTS
62+
EOT_UTILS_EXISTS=$(checkIfDebPackageIsInstalled eot-utils)
63+
if [ -z "${EOT_UTILS_EXISTS}" ]; then
64+
echo "eot-utils is not installed. Installing the package..."
65+
66+
sudo apt install -y eot-utils
67+
else
68+
echo "eot-utils is already installed."
69+
fi
70+
71+
local WGET_EXISTS
72+
WGET_EXISTS=$(checkIfDebPackageIsInstalled wget)
73+
if [ -z "${WGET_EXISTS}" ]; then
74+
echo "wget is not installed. Installing the package..."
75+
76+
sudo apt install -y wget
77+
else
78+
echo "wget is already installed."
79+
fi
4180
}
4281

4382
##
@@ -90,6 +129,7 @@ createFontsDist() {
90129
# Generates the iconfont.
91130
##
92131
generate() {
132+
installTools
93133
cleanupSourceAndDistFonts
94134
downloadSourceFonts
95135
createFontsDist

0 commit comments

Comments
 (0)