From 07b47ebe6b266f437ab1eb37498a688796defacf Mon Sep 17 00:00:00 2001 From: Xuesong Peng Date: Sat, 17 Aug 2024 10:56:58 +0800 Subject: [PATCH] chore: use submodule for dependencies --- .github/workflows/ci.yaml | 40 ++++++++++----------------------------- .gitmodules | 6 ++++++ deps/opencc-tonggui | 1 + deps/rime-emoji | 1 + 4 files changed, 18 insertions(+), 30 deletions(-) create mode 100644 .gitmodules create mode 160000 deps/opencc-tonggui create mode 160000 deps/rime-emoji diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 141213d..0369dba 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,6 +32,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: 'recursive' - name: Make Dicts run: | @@ -41,29 +43,21 @@ jobs: make dicts DEWEIGHT=1 VERSION=${{ github.ref_name }} fi - - name: Install Dependencies - run: sudo apt-get install -y opencc - - - name: Fetch Emoji + - 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 - 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 + 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 emoji/opencc/emoji.json schema/opencc/ - fi + cp deps/rime-emoji/opencc/emoji.json schema/opencc/ - - 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 + make -C deps/opencc-tonggui + cp deps/opencc-tonggui/opencc/* schema/opencc/ + fi - name: Make Zip run: | @@ -122,17 +116,3 @@ jobs: 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" diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6e54371 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "deps/rime-emoji"] + path = deps/rime-emoji + url = https://github.com/rime/rime-emoji +[submodule "deps/opencc-tonggui"] + path = deps/opencc-tonggui + url = https://github.com/amorphobia/opencc-tonggui diff --git a/deps/opencc-tonggui b/deps/opencc-tonggui new file mode 160000 index 0000000..1489b91 --- /dev/null +++ b/deps/opencc-tonggui @@ -0,0 +1 @@ +Subproject commit 1489b91368b2ec7bf25da6fb7e0d7b5029369ce5 diff --git a/deps/rime-emoji b/deps/rime-emoji new file mode 160000 index 0000000..be7d308 --- /dev/null +++ b/deps/rime-emoji @@ -0,0 +1 @@ +Subproject commit be7d308e42c4c4485229de37ec0afb7bafbfafc0