16
16
- ' install.ps1'
17
17
- ' install.sh'
18
18
- ' LICENSE'
19
- - ' package**'
20
19
21
20
# Allows you to run this workflow manually from the Actions tab
22
21
workflow_dispatch :
@@ -27,18 +26,72 @@ jobs:
27
26
runs-on : ubuntu-latest
28
27
29
28
steps :
30
- - uses : actions/checkout@v3
31
- -
29
+ # Faster version instead of - uses: actions/checkout@v3
30
+ - uses : Bhacaz/checkout-files@v2
31
+ with :
32
+ files : package.json bin/scripts/get-font-names-from-json.sh bin/scripts/lib/fonts.json
33
+ branch : ${{ github.head_ref || github.ref_name }}
34
+
35
+ - name : Determine font matrix
32
36
id : set-matrix
33
37
run : |
34
38
cd -- $GITHUB_WORKSPACE/bin/scripts/
39
+ chmod u+x get-font-names-from-json.sh
35
40
fontNames=$(./get-font-names-from-json.sh)
36
41
echo "${fontNames}"
37
42
echo "::set-output name=matrix::${fontNames}"
38
43
echo ${{ steps.set-matrix.outputs.matrix }}
39
44
45
+ - name : Fetch release version
46
+ id : rel_ver
47
+ run : |
48
+ cd -- "$GITHUB_WORKSPACE"
49
+ echo "Contents of package.json:"
50
+ cat package.json
51
+ RELEASE_VERSION=$(jq '.version' package.json | sed 's/[ ",]//g')
52
+ echo "::set-output name=val::$RELEASE_VERSION"
53
+
54
+ - name : Determine candidate status
55
+ id : rel_can
56
+ run : |
57
+ [[ "${{ steps.rel_ver.outputs.val }}" == *"-RC"* ]] && echo "::set-output name=val::true" || echo "::set-output name=val::false"
58
+
59
+ - name : Determine new release or re-release
60
+ # If the tag exists it is obviously a re-release
61
+
62
+ # This would need a complete checkout, that we want to avoid
63
+
64
+ # with:
65
+ # tag: "v${{ steps.rel_ver.outputs.val }}"
66
+ # env:
67
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68
+ id : rel_pre_existing
69
+ run : |
70
+ curl -v "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/tags" | jq '.[].name' | grep '^"v${{ steps.rel_ver.outputs.val }}"$' \
71
+ && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
72
+ echo "Tag exists: ${{ steps.rel_pre_existing.outputs.exists }}"
73
+
74
+ - name : Upload release only on first trigger for release and always on release candidate
75
+ id : upload
76
+ # Upload release when:
77
+ # * This is a new (previously untagged) release
78
+ # * This is a release candidate
79
+ run : |
80
+ [[ "${{ steps.rel_can.outputs.val }}" == "true" || "${{ steps.rel_pre_existing.outputs.exists }}" == "false" ]] && echo "::set-output name=val::true" || echo "::set-output name=val::false"
81
+
82
+ - name : Show outputs
83
+ run : |
84
+ echo "rel_version: ${{ steps.rel_ver.outputs.val }}"
85
+ echo "rel_candidate: ${{ steps.rel_can.outputs.val }}"
86
+ echo "rel_pre_existing: ${{ steps.rel_pre_existing.outputs.exists }}"
87
+ echo "rel_upload: ${{ steps.upload.outputs.val }}"
88
+
40
89
outputs :
41
90
matrix : ${{ steps.set-matrix.outputs.matrix }}
91
+ rel_version : ${{ steps.rel_ver.outputs.val }}
92
+ rel_candidate : ${{ steps.rel_can.outputs.val }}
93
+ rel_pre_existing : ${{ steps.rel_pre_existing.outputs.exists }}
94
+ rel_upload : ${{ steps.upload.outputs.val }}
42
95
43
96
# Workflow to build and install dependencies
44
97
build :
50
103
env :
51
104
GITHUB_ACCESS_TOKEN : ${{ secrets.ACCESS_TOKEN }}
52
105
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
106
+ RELEASE_VERSION : ${{ needs.setup-fonts-matrix.outputs.rel_version }}
107
+ RELEASE_CANDIDATE : ${{ needs.setup-fonts-matrix.outputs.rel_candidate }}
53
108
54
109
strategy :
55
110
matrix :
@@ -58,17 +113,11 @@ jobs:
58
113
steps :
59
114
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
60
115
- uses : actions/checkout@v3
61
- - name : Set release variables
116
+ - name : Check release variables
62
117
run : |
63
- cd -- "$GITHUB_WORKSPACE"
64
- cat package.json
65
- RELEASE_TAG_VERSION=$(cat package.json \
66
- | grep version \
67
- | head -1 \
68
- | awk -F: '{ print $2 }' \
69
- | sed 's/[",]//g')
70
- echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV
71
- [[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "RELEASE_CANDIDATE=true" || echo "RELEASE_CANDIDATE=false" >> $GITHUB_ENV
118
+ echo "$RELEASE_VERSION"
119
+ echo "Candidate: $RELEASE_CANDIDATE"
120
+ echo "Publish/refresh release: ${{ needs.setup-fonts-matrix.outputs.rel_upload }}"
72
121
73
122
# Install and setup Dependencies
74
123
# @TODO cache the next 4 steps with actions/cache or upload
@@ -92,11 +141,15 @@ jobs:
92
141
echo Try appimage with path
93
142
fontforge --version
94
143
144
+ # It is unclear what this has been needed for
95
145
- name : Setup additional dependencies
146
+ if : false
96
147
run : |
97
148
pip install fonttools --quiet
98
149
150
+ # It is unclear what this has been needed for
99
151
- name : Build FreeType from source
152
+ if : false
100
153
run : |
101
154
wget http://downloads.sourceforge.net/project/freetype/freetype2/2.7/freetype-2.7.tar.gz --quiet
102
155
tar -zxf freetype-2.7.tar.gz
@@ -105,7 +158,9 @@ jobs:
105
158
make --quiet
106
159
sudo make install --quiet
107
160
161
+ # It is unclear what this has been needed for
108
162
- name : Build Harfbuzz from source
163
+ if : false
109
164
run : |
110
165
wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.3.4.tar.bz2 --quiet
111
166
tar -xjf harfbuzz-1.3.4.tar.bz2
@@ -119,12 +174,10 @@ jobs:
119
174
fontforge --version
120
175
fontforge --version 2>&1 | grep libfontforge | awk '{print $NF}'
121
176
122
- - name : Bump version for source files once
123
- # @todo fixme - put in a separate job with the release env setup and output the release info
124
- if : ${{ matrix.font == '3270' }}
177
+ - name : Bump version for source files
125
178
run : |
126
179
cd -- "$GITHUB_WORKSPACE/bin/scripts"
127
- ./version-bump.sh "$RELEASE_TAG_VERSION "
180
+ ./version-bump.sh "$RELEASE_VERSION "
128
181
129
182
- name : Standardize the readme files
130
183
run : |
@@ -137,17 +190,25 @@ jobs:
137
190
fontforge --script `pwd`/../../font-patcher --version
138
191
./gotta-patch-em-all-font-patcher\!.sh "/${{ matrix.font }}"
139
192
140
- - name : Generate fontconfig and casks
193
+ - name : Archive font package zip files
141
194
run : |
142
195
cd -- "$GITHUB_WORKSPACE/bin/scripts"
143
- ./generate-fontconfig.sh
144
- ./generate-casks.sh "${{ matrix.font }}"
196
+ ./archive-fonts.sh "${{ matrix.font }}"
145
197
146
- - name : Archive font package zip files and upload for release
198
+ - name : Generate cask
199
+ # The casks are not used at the moment, but probably Ryan
200
+ # wanted to push them out somewhere
147
201
run : |
148
202
cd -- "$GITHUB_WORKSPACE/bin/scripts"
149
- ./archive-fonts.sh "${{ matrix.font }}"
150
- GITHUB_TOKEN=$GITHUB_TOKEN PRERELEASE=$RELEASE_CANDIDATE ./upload-archives.sh $RELEASE_TAG_VERSION "${{ matrix.font }}"
203
+ ./generate-casks.sh "${{ matrix.font }}"
204
+
205
+ - name : Upload zip file archive for release
206
+
207
+ if : needs.setup-fonts-matrix.outputs.rel_upload == 'true'
208
+ with :
209
+ prerelease : ${{ env.RELEASE_CANDIDATE != 'false' }}
210
+ tag_name : " v${{ env.RELEASE_VERSION }}"
211
+ files : archives/*
151
212
152
213
- name : Upload patched fonts as artifacts
153
214
uses : actions/upload-artifact@v2
@@ -159,42 +220,50 @@ jobs:
159
220
patched-fonts/${{ matrix.font }}
160
221
LICENSE
161
222
223
+ - name : Upload casks as artifacts
224
+ uses : actions/upload-artifact@v2
225
+ with :
226
+ name : casks
227
+ # adding multiple paths (i.e. LICENSE) is a workaround to get a least common ancestor
228
+ # of the root directory for artifact path purposes
229
+ path : |
230
+ casks/${{ matrix.font }}
231
+ LICENSE
232
+
162
233
release-font-patcher :
163
234
name : Archive font patcher and add to release
164
- needs : build
235
+ needs : [ setup-fonts-matrix, build ]
165
236
166
237
env :
167
238
GITHUB_ACCESS_TOKEN : ${{ secrets.ACCESS_TOKEN }}
168
239
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
240
+ RELEASE_VERSION : ${{ needs.setup-fonts-matrix.outputs.rel_version }}
241
+ RELEASE_CANDIDATE : ${{ needs.setup-fonts-matrix.outputs.rel_candidate }}
169
242
170
243
runs-on : ubuntu-latest
171
244
steps :
172
245
- uses : actions/checkout@v3
173
- - name : Set release variables
246
+ - name : Bump version for source files
174
247
run : |
175
- cd -- "$GITHUB_WORKSPACE"
176
- cat package.json
177
- RELEASE_TAG_VERSION=$(cat package.json \
178
- | grep version \
179
- | head -1 \
180
- | awk -F: '{ print $2 }' \
181
- | sed 's/[",]//g')
182
- echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV
183
- [[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "RELEASE_CANDIDATE=true" || echo "RELEASE_CANDIDATE=false" >> $GITHUB_ENV
248
+ cd -- "$GITHUB_WORKSPACE/bin/scripts"
249
+ ./version-bump.sh "$RELEASE_VERSION"
184
250
185
251
- name : Archive font-patcher script for release
186
252
run : |
187
253
cd -- "$GITHUB_WORKSPACE/bin/scripts"
188
254
./archive-font-patcher.sh
189
255
190
- - name : Archive font package zip files and upload for release
191
- run : |
192
- cd -- "$GITHUB_WORKSPACE/bin/scripts"
193
- GITHUB_TOKEN=$GITHUB_TOKEN PRERELEASE=$RELEASE_CANDIDATE ./upload-archives.sh $RELEASE_TAG_VERSION "FontPatcher"
256
+ - name : Upload font-patcher archive for release
257
+
258
+ if : needs.setup-fonts-matrix.outputs.rel_upload == 'true'
259
+ with :
260
+ prerelease : ${{ env.RELEASE_CANDIDATE != 'false' }}
261
+ tag_name : " v${{ env.RELEASE_VERSION }}"
262
+ files : archives/*
194
263
195
264
commit :
196
265
name : Commit and push patched fonts to the repo
197
- needs : build
266
+ needs : [ setup-fonts-matrix, build ]
198
267
runs-on : ubuntu-latest
199
268
steps :
200
269
- uses : actions/checkout@v3
@@ -210,9 +279,50 @@ jobs:
210
279
name : patched-fonts
211
280
path : .
212
281
213
- - uses : EndBug/add-and-commit@v9
282
+ - name : Bump version for source files
283
+ env :
284
+ RELEASE_VERSION : ${{ needs.setup-fonts-matrix.outputs.rel_version }}
285
+ RELEASE_CANDIDATE : ${{ needs.setup-fonts-matrix.outputs.rel_candidate }}
286
+ run : |
287
+ cd -- "$GITHUB_WORKSPACE/bin/scripts"
288
+ ./version-bump.sh "$RELEASE_VERSION"
289
+
290
+ - name : Commit version bump changes
291
+ # If there are no changes (i.e. we already have that bump commit from a previous run)
292
+ # the git commit will fail as empty commit (that we do not explicitely allow here),
293
+ # and the action fails silently (i.e. without stopping the job).
294
+ # This means there will be only one commit in the repo for each version tag change,
295
+ # regardless of how often we run the release CI.
296
+ uses : EndBug/add-and-commit@v9
297
+ with :
298
+ add : " ['font-patcher', 'bin/scripts']"
299
+ message : " [ci] Bump release version"
300
+ committer_name : GitHub Actions
301
+ committer_email : 41898282+github-actions[bot]@users.noreply.github.com
302
+
303
+ - name : Commit patched fonts back to repo
304
+ uses : EndBug/add-and-commit@v9
214
305
with :
215
306
add : ' patched-fonts'
216
- message : Rebuilds patched fonts
307
+ message : " [ci] Rebuilds patched fonts"
308
+ committer_name : GitHub Actions
309
+ committer_email : 41898282+github-actions[bot]@users.noreply.github.com
310
+
311
+ - name : Generate fontconfig
312
+ run : |
313
+ cd -- "$GITHUB_WORKSPACE/bin/scripts"
314
+ ./generate-fontconfig.sh
315
+
316
+ - name : Commit fontconfig back to repo
317
+ uses : EndBug/add-and-commit@v9
318
+ with :
319
+ add : ' 10-nerd-font-symbols.conf'
320
+ message : " [ci] Regenerate fontconfig"
217
321
committer_name : GitHub Actions
218
322
committer_email : 41898282+github-actions[bot]@users.noreply.github.com
323
+
324
+ - name : Adjust release tag to include previous commit
325
+
326
+ if : needs.setup-fonts-matrix.outputs.rel_upload == 'true'
327
+ with :
328
+ ref : " v${{ needs.setup-fonts-matrix.outputs.rel_version }}"
0 commit comments