-
Notifications
You must be signed in to change notification settings - Fork 6
83 lines (73 loc) · 2.45 KB
/
split.yaml
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
name: Split Fonts
on:
workflow_dispatch:
jobs:
build:
name: get the fonts
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
node-version: '>=18.0.0'
registry-url: https://registry.npmjs.org
- name: Download fonts
id: down
uses: robinraju/[email protected]
with:
repository: lxgw/LxgwWenKai-Screen
latest: true
out-file-path: "tmp"
- name: Split fonts
run: |
npm install cn-font-split -g
rm -rf ./fonts/
rm -rf ./style.css
rm -rf ./VERSION
for i in $(echo "$(ls ./tmp)" | grep -i '\.ttf$')
do
font_name=$(echo "$i" | sed -E 's/(.+)\.ttf$/\1/i' | tr '[:upper:]' '[:lower:]')
cn-font-split -i=./tmp/$i -o=./fonts/$font_name --renameOutputFont='[index][ext]'
echo "@import url('./$font_name/result.css');" >> ./style.css
done
echo "${{ steps.down.outputs.tag_name }}" >> VERSION
mv VERSION fonts/VERSION
mv style.css fonts/style.css
rm -rf ./tmp/
- name: Auto Minify
uses: nizarmah/[email protected]
- name: Commit files
run: |
# mv style.min.css fonts/style.min.css
cd fonts || exit 1
git init
git config user.email github-actions[bot]@users.noreply.github.com
git config user.name github-actions[bot]
git checkout -b latest
git status
git add .
git commit -m "update ${{ steps.down.outputs.tag_name }}" -a
git tag ${{ steps.down.outputs.tag_name }}
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
tags: true
directory: fonts
branch: latest
- name: Edit package.json And Publish
run: |
git checkout main -- package.json
mv package.json fonts/package.json
cd fonts
VER=$(cat VERSION)
NORMALIZED_VERSION=$(echo $VER | sed 's/^v//' | awk -F. '{if($3==null) print$1"."$2".0"; else print$0}')
npm version $NORMALIZED_VERSION --no-git-tag-version
- run: |
cd fonts
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}