-
Notifications
You must be signed in to change notification settings - Fork 5
127 lines (112 loc) · 3.62 KB
/
ci.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
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
name: Continuous Integration
on:
workflow_dispatch:
inputs:
disable_de_weight_630:
description: '禁用权重降低选项 true / false (默认不禁用)'
required: true
default: 'false'
push:
branches:
- master
- dev
tags:
- 'v*'
jobs:
sanity-check:
name: Dictionary Sanity Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sanity Check
run: |
make check
pack-schema:
name: Pack Schema
runs-on: ubuntu-latest
needs: sanity-check
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Make Dicts
run: |
if [[ "${{ github.event.inputs.disable_de_weight_630 }}" == "true" ]]; then
make dicts VERSION=${{ github.ref_name }}
else
make dicts DEWEIGHT=1 VERSION=${{ github.ref_name }}
fi
- name: Build Opencc Dependencies
run: |
sudo apt-get install -y opencc
if command -v opencc &> /dev/null; then
echo "$(opencc --version)"
mkdir -p schema/opencc
opencc -c t2s.json -i deps/rime-emoji/opencc/emoji_category.txt | awk '!seen[$1]++' > schema/opencc/emoji_category.txt
opencc -c t2s.json -i deps/rime-emoji/opencc/emoji_word.txt | awk '!seen[$1]++' > schema/opencc/emoji_word.txt
# https://github.com/rime/rime-emoji/issues/48
sed -i 's/鼔/鼓/g' schema/opencc/emoji_word.txt
cp deps/rime-emoji/opencc/emoji.json schema/opencc/
make -C deps/opencc-tonggui
cp deps/opencc-tonggui/opencc/* schema/opencc/
fi
- name: Make Zip
run: |
cd schema
rm recipe.yaml
zip -r -q ../jiandao.zip * -x rime.lua
- name: Make Legacy Zip
run: |
cd schema
sed -i 's/*jiandao\///g' jiandao.schema.yaml
zip -r -q ../jiandao-legacy.zip *
- name: Make Xiaoxiao Zip
run: |
cd xiaoxiao
zip -r -q ../jiandao-xiaoxiao.zip *
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: zips
path: |
jiandao.zip
jiandao-legacy.zip
jiandao-xiaoxiao.zip
create-release:
name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: pack-schema
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: zips
- name: Unzip & Rename Release Zip Archive
run: |
unzip jiandao.zip -d release
mv schema/recipe.yaml release/
mv jiandao.zip jiandao-${{ github.ref_name }}.zip
mv jiandao-legacy.zip jiandao-legacy-${{ github.ref_name }}.zip
mv jiandao-xiaoxiao.zip jiandao-xiaoxiao-${{ github.ref_name }}.zip
cp scripts/installer.bat weasel-installer.bat
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
files: |
jiandao-${{ github.ref_name }}.zip
jiandao-legacy-${{ github.ref_name }}.zip
jiandao-xiaoxiao-${{ github.ref_name }}.zip
weasel-installer.bat
- name: Push to Release
uses: s0/git-publish-subdir-action@v2.6.0
env:
REPO: self
BRANCH: release
FOLDER: release
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MESSAGE: "Release ${{ github.ref_name }}"