Skip to content

chore(ci): add dictionary sanity check #29

chore(ci): add dictionary sanity check

chore(ci): add dictionary sanity check #29

Workflow file for this run

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: |
bash scripts/sanity_check.sh
pack-schema:
name: Pack Schema
runs-on: ubuntu-latest
needs: sanity-check
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Make Dicts (disable de-weight 630)
if: github.event.inputs.de_weight_630 == 'true'
run: |
bash scripts/make_dicts.sh --append dicts/cizu_append.txt --delete dicts/cizu_delete.txt --modify dicts/cizu_modify.txt --version ${{ github.ref_name }}
- name: Make Dicts (de-weight 630)
if: github.event.inputs.de_weight_630 != 'true'
run: |
bash scripts/make_dicts.sh --append dicts/cizu_append.txt --delete dicts/cizu_delete.txt --modify dicts/cizu_modify.txt --version ${{ github.ref_name }} --deweight
- 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: Make Zip
run: |
cd schema
rm recipe.yaml
zip -r -q ../jiandao.zip *
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: jiandao.zip
path: jiandao.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: jiandao.zip
- 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
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
with:
files: jiandao-${{ github.ref_name }}.zip
- name: Push to Release
uses: s0/[email protected]
env:
REPO: self
BRANCH: release
FOLDER: release
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MESSAGE: "Release ${{ github.ref_name }}"