-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-fonts-json.yml
More file actions
44 lines (38 loc) · 1.31 KB
/
update-fonts-json.yml
File metadata and controls
44 lines (38 loc) · 1.31 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
name: Auto-update fonts.json
on:
push:
paths:
- 'Fonts/*.msdf.json' # Trigger when a .msdf.json file in Fonts folder changes
jobs:
update-fonts-json:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16' # Compatible version
# Step 3: Generate fonts.json
- name: Generate fonts.json
run: |
node -e "
const fs = require('fs');
const path = require('path');
const fontsDir = path.join(process.cwd(), 'Fonts');
const outputJson = path.join(fontsDir, 'fonts.json');
fs.readdir(fontsDir, (err, files) => {
if (err) throw err;
const fontFiles = files.filter(file => file.endsWith('.msdf.json'));
const fontsJson = { fonts: fontFiles };
fs.writeFileSync(outputJson, JSON.stringify(fontsJson, null, 2));
});
"
# Step 4: Commit and push changes
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Auto-update fonts.json"
file_pattern: Fonts/fonts.json