chore: expand danzi #225
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |