-
Notifications
You must be signed in to change notification settings - Fork 5
137 lines (121 loc) · 3.96 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
128
129
130
131
132
133
134
135
136
137
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@v3
- name: Sanity Check
run: |
make check
pack-schema:
name: Pack Schema
runs-on: ubuntu-latest
needs: sanity-check
steps:
- name: Checkout
uses: actions/checkout@v3
- 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: Install Dependencies
run: sudo apt-get install -y opencc
- name: Fetch Emoji
run: |
if command -v opencc &> /dev/null; then
echo "$(opencc --version)"
mkdir -p schema/opencc
rm -rf emoji
git clone --depth 1 https://github.com/rime/rime-emoji emoji
opencc -c t2s.json -i emoji/opencc/emoji_category.txt | awk '!seen[$1]++' > schema/opencc/emoji_category.txt
opencc -c t2s.json -i 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 emoji/opencc/emoji.json schema/opencc/
fi
- name: Fetch opencc-tonggui
run: |
TAG=$(curl -s https://api.github.com/repos/amorphobia/opencc-tonggui/releases/latest | jq -r '.tag_name')
URL="https://github.com/amorphobia/opencc-tonggui/releases/download/${TAG}/opencc-tonggui-${TAG}.zip"
wget -O tonggui.zip ${URL}
unzip tonggui.zip -d schema
- 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: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: zips
path: |
jiandao.zip
jiandao-legacy.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@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
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
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
with:
files: |
jiandao-${{ github.ref_name }}.zip
jiandao-legacy-${{ github.ref_name }}.zip
- 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 }}"
# sync-gitee:
# name: Sync to Gitee
# runs-on: ubuntu-latest
# needs: pack-schema
# steps:
# - name: Hub Mirror Action
# uses: Yikun/hub-mirror-action@master
# with:
# src: github/amorphobia
# dst: gitee/amorphobia
# dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
# dst_token: ${{ secrets.GITEE_TOKEN }}
# static_list: "rime-jiandao"