From 5b9c8faeec37b5608de9d374493c0465a73d374f Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 7 Feb 2024 17:56:31 +0800 Subject: [PATCH] commit ci with librime nightly built --- .github/workflows/commit-ci.yml | 12 ++++-- .github/workflows/release-ci.yml | 21 +++++++---- github.install.bat | 63 ++++++++++++++++++++------------ 3 files changed, 62 insertions(+), 34 deletions(-) diff --git a/.github/workflows/commit-ci.yml b/.github/workflows/commit-ci.yml index 928113020..a4627fc30 100644 --- a/.github/workflows/commit-ci.yml +++ b/.github/workflows/commit-ci.yml @@ -46,8 +46,8 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.1.3 - - name: build librime - if: ${{ success() }} + - name: Build librime + if: ${{ startsWith(github.ref, 'refs/tags/') && success() }} env: rime_plugins: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict run: | @@ -56,11 +56,17 @@ jobs: .\action-install-plugins-windows.bat popd .\build.bat librime + .\build.bat opencc + + - name: Copy Rime files(Nightly Build) + if: ${{ !startsWith(github.ref, 'refs/tags/') && success() }} + run: | + .\github.install.bat - name: Build Weasel id: build_weasel run: | - .\build.bat opencc + #.\build.bat opencc .\build.bat data .\build.bat hant .\build.bat installer diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 9d6767bcc..637bc94ea 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -43,22 +43,27 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.1.3 - - name: build librime - if: ${{ success() }} + - name: Build librime + if: ${{ startsWith(github.ref, 'refs/tags/') && success() }} + env: + rime_plugins: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict run: | # load plugins - pushd librime\plugins\ - git clone -v --depth=1 https://github.com/hchunhui/librime-lua.git - git clone -v --depth=1 -b thirdparty https://github.com/hchunhui/librime-lua.git librime-lua\thirdparty - git clone -v --depth=1 https://github.com/rime/librime-predict.git - git clone -v --depth=1 https://github.com/lotem/librime-octagram.git + pushd librime + .\action-install-plugins-windows.bat popd .\build.bat librime + .\build.bat opencc + + - name: Copy Rime files(Nightly Build) + if: ${{ !startsWith(github.ref, 'refs/tags/') && success() }} + run: | + .\github.install.bat - name: Build Weasel id: build_weasel run: | - .\build.bat opencc + #.\build.bat opencc .\build.bat data .\build.bat hant .\build.bat installer diff --git a/github.install.bat b/github.install.bat index f7256d04b..6662131cd 100644 --- a/github.install.bat +++ b/github.install.bat @@ -1,23 +1,40 @@ -setlocal - -git submodule init -git submodule update plum - -set rime_version=1.9.0 - -set download_archive=rime-a608767-Windows-msvc.7z -set download_archive_deps=rime-deps-a608767-Windows-msvc.7z - -curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive% -curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive_deps% - -7z x %download_archive% * -olibrime\ -y -7z x %download_archive_deps% * -olibrime\ -y - -copy /Y librime\dist\include\rime_*.h include\ -copy /Y librime\dist\lib\rime.lib lib\ -copy /Y librime\dist\lib\rime.dll output\ - -if not exist output\data\opencc mkdir output\data\opencc -copy /Y librime\share\opencc\*.* output\data\opencc\ - +setlocal + +git submodule init +git submodule update plum + +rem set rime_version=1.9.0 +rem +rem set download_archive=rime-a608767-Windows-msvc.7z +rem set download_archive_deps=rime-deps-a608767-Windows-msvc.7z + +setlocal enabledelayedexpansion +rem fetch librime nightly build +set rime_version=latest +pushd librime +git pull -v origin master +popd +set "filePath=.git/modules/librime/refs/heads/master" + +for /f "delims=" %%i in (%filePath%) do ( + set "fileContent=%%i" + set "latestCommitId=!fileContent:~0,7!" + goto :breakLoop +) +:breakLoop +set download_archive=rime-%latestCommitId%-Windows-msvc.7z +set download_archive_deps=rime-deps-%latestCommitId%-Windows-msvc.7z + +curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive% +curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive_deps% + +7z x %download_archive% * -olibrime\ -y +7z x %download_archive_deps% * -olibrime\ -y + +copy /Y librime\dist\include\rime_*.h include\ +copy /Y librime\dist\lib\rime.lib lib\ +copy /Y librime\dist\lib\rime.dll output\ + +if not exist output\data\opencc mkdir output\data\opencc +copy /Y librime\share\opencc\*.* output\data\opencc\ +