-
-
Notifications
You must be signed in to change notification settings - Fork 1k
executable file
·164 lines (154 loc) · 5.46 KB
/
custom.yml
File metadata and controls
executable file
·164 lines (154 loc) · 5.46 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
name: Custom Build
on:
workflow_dispatch:
inputs:
cn:
description: 'Include Chinese version (add "--cn" to build args)'
required: false
default: false
type: boolean
normal:
description: 'Remove opinionated features (add "--normal" to build args)'
required: false
default: false
type: boolean
no_liga:
description: 'Remove ligatures (add "--no-liga" to build args)'
required: false
default: false
type: boolean
no_hinted:
description: 'Build unhinted font (add "--no-hinted" to build args)'
required: false
default: false
type: boolean
width:
description: 'Glyph width mode (add "--width <default|narrow|slim>" to build args)'
required: false
default: default
type: choice
options:
- default
- narrow
- slim
nerd_font:
description: 'Nerd Font icon mode: default("--nf"), mono("--nf-mono"), proportional("--nf-propo")'
required: false
default: default
type: choice
options:
- default
- mono
- proportional
feat:
description: 'Enable features, split by `,`, e.g. "cv01,ss02" (add "--feat feat1,feat2" to build args)'
required: false
default: ''
type: string
build_args:
description: 'Other args for build.py'
required: false
default: ''
type: string
permissions:
contents: write
jobs:
custom-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: './requirements.txt'
- name: Install dependencies
run: |
pip install -r requirements.txt
# https://github.com/ryanoasis/nerd-fonts/blob/b3c1b0cf424ac32915cf4fd822c3938d4a815566/.github/workflows/release.yml#L144-L166
if [[ "${{ github.event.inputs.build_args }}" == *"--font-patcher"* ]] || python build.py --dry | jq -e '.nerd_font.use_font_patcher == true' >/dev/null; then
sudo apt update -y -q
sudo apt install software-properties-common -y -q
sudo apt install python3-fontforge -y -q
sudo apt install fuse -y -q
curl -L "https://github.com/fontforge/fontforge/releases/download/20230101/FontForge-2023-01-01-a1dad3e-x86_64.AppImage" --output fontforge
chmod u+x fontforge
echo Try appimage
./fontforge --version
export PATH=`pwd`:$PATH
echo "PATH=$PATH" >> $GITHUB_ENV
echo Try appimage with path
fontforge --version
fi
- name: Run custom script
run: |
build_args="--archive"
if [ "${{ github.event.inputs.cn }}" == "true" ]; then
build_args="$build_args --cn"
fi
if [ "${{ github.event.inputs.normal }}" == "true" ]; then
build_args="$build_args --normal"
fi
if [ "${{ github.event.inputs.no_liga }}" == "true" ]; then
build_args="$build_args --no-liga"
fi
if [ "${{ github.event.inputs.no_hinted }}" == "true" ]; then
build_args="$build_args --no-hinted"
fi
if [ "${{ github.event.inputs.width }}" != "default" ]; then
build_args="$build_args --width ${{ github.event.inputs.width }}"
fi
case "${{ github.event.inputs.nerd_font }}" in
default)
build_args="$build_args --nf"
;;
mono)
build_args="$build_args --nf-mono"
;;
proportional)
build_args="$build_args --nf-propo"
;;
esac
if [ -n "${{ github.event.inputs.feat }}" ]; then
build_args="$build_args --feat ${{ github.event.inputs.feat }}"
fi
if [ -n "${{ github.event.inputs.build_args }}" ]; then
build_args="$build_args ${{ github.event.inputs.build_args }}"
fi
echo "BUILD_ARGS=$build_args" >> $GITHUB_ENV
python build.py $build_args
continue-on-error: true
- id: check_issue
name: Check issue feature file
run: |
if [ -f fonts/issue.fea ]
then
echo 'exists=true' >> $GITHUB_OUTPUT
else
echo 'exists=false' >> $GITHUB_OUTPUT
fi
- name: Upload issue artifact
if: ${{ steps.check_issue.outputs.exists == 'true' }}
uses: actions/upload-artifact@v4
with:
name: issue-fea-file
path: fonts/issue.fea
- name: Create release
run: |
if [ ! -d "fonts/archive" ]; then
echo "Error: Failed to build font, please check [Run custom script] step."
exit 1
fi
echo "### Build arguments" >> NOTES
echo "\`\`\`" >> NOTES
echo "python build.py $BUILD_ARGS" >> NOTES
echo "\`\`\`" >> NOTES
echo "### Final Configuration" >> NOTES
echo "\`\`\`" >> NOTES
python build.py $BUILD_ARGS --dry | sed '1s/^/font_config: /' >> NOTES
echo "\`\`\`" >> NOTES
gh release create "v$(date +%s)" fonts/archive/*.* --notes-file NOTES
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}