Files
rime-ice/.github/workflows/release.yml
2026-04-27 14:23:29 +08:00

155 lines
4.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Test and Release
on:
push:
branches:
- main
tags:
- "[0-9]+.*"
paths:
- "**/**"
- "!**.md"
- "!**.gitignore"
- "!.github/**"
workflow_dispatch:
jobs:
release:
name: Test and Release
runs-on: ubuntu-24.04
if: github.repository == 'iDvel/rime-ice'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
# Test
- name: Install lint dependencies
run: |
echo "Install lint dependencies..."
python3 -m pip install yamllint
sudo apt install -y luarocks
sudo luarocks install luacheck
- name: Cache rime cli bundle
uses: actions/cache@v5
with:
path: ${{ runner.temp }}/rime-cli-cache/rime-cli-linux-1.6.1.zip
key: rime-cli-linux-1.6.1
- name: Run lint
run: make -C others/script lint
- name: Run smoke test suite
env:
RIME_CLI_URL: https://github.com/mirtlecn/public/releases/download/v1.6.1/rime-cli-linux-1.6.1.zip
RIME_CLI_CACHE_PATH: ${{ runner.temp }}/rime-cli-cache/rime-cli-linux-1.6.1.zip
run: make -C others/script smoke
# build
- name: Setup Go
if: ${{ contains(github.event.head_commit.message, ' [build]') || github.event_name == 'workflow_dispatch' }}
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Check and build
id: check_and_build
if: ${{ contains(github.event.head_commit.message, ' [build]') || github.event_name == 'workflow_dispatch' }}
run: |
cd others/script
go mod tidy
go run main.go --rime_path "${{ github.workspace }}" --auto_confirm
- name: Pack dicts
run: |
rm -rf dist
mkdir dist
echo "Pack all ..."
find . -maxdepth 1 -name "*.lua" -o -name "*.yaml" -o -name "*.txt" | zip dist/full.zip -@
zip -r dist/full.zip cn_dicts en_dicts lua opencc LICENSE
echo "Pack dicts ..."
zip -r dist/all_dicts.zip cn_dicts en_dicts opencc radical_pinyin.dict.yaml
echo "Pack cn_dicts ..."
zip -r dist/cn_dicts.zip cn_dicts
echo "Pack en_dicts ..."
zip -r dist/en_dicts.zip en_dicts
echo "Pack opencc ..."
zip -r dist/opencc.zip opencc
echo "Pack binary for fcitx5.js ..."
zip -r dist/fcitx5_rime_js-rime_ice.zip build lua opencc custom_phrase.txt
- name: Create nightly release
if: ${{ github.ref == 'refs/heads/main' }}
uses: softprops/action-gh-release@v3
with:
body: |
## 说明
这里是每次提交后自动打包的版本,包含最新的功能和词库
- `full.zip` : 包含所有词典和方案文件
- `cn_dicts.zip`:中文词库
- `en_dicts.zip`:英文词库
- `opencc.zip`opencc 词库emoji 等)
- `all_dicts.zip`:以上三个词库的整合
- `fcitx5_rime_js-rime_ice.zip`:适用于 fcitx5-rime.js 的预构建包
tag_name: nightly
preserve_order: true
name: "nightly build"
make_latest: true
files: |
dist/full.zip
dist/all_dicts.zip
dist/cn_dicts.zip
dist/en_dicts.zip
dist/opencc.zip
dist/fcitx5_rime_js-rime_ice.zip
- name: Create stable release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v3
with:
body: |
## 重要更新
**release notes**
## 说明
- `full.zip` : 包含所有词典和方案文件
- `cn_dicts.zip`:中文词库
- `en_dicts.zip`:英文词库
- `opencc.zip`opencc 词库emoji 等)
- `all_dicts.zip`:以上三个词库的整合
- `fcitx5_rime_js-rime_ice.zip`:适用于 fcitx5-rime.js 的预构建包
draft: true
preserve_order: true
make_latest: true
files: |
dist/full.zip
dist/all_dicts.zip
dist/cn_dicts.zip
dist/en_dicts.zip
dist/opencc.zip
dist/fcitx5_rime_js-rime_ice.zip
- name: Push and commit
if: ${{ steps.check_and_build.outcome == 'success' }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add --all
if ! git diff --cached --quiet; then
COMMIT_MSG=$(git log -1 --pretty=%B | sed -e 's/\s\[build\]$//' -e 's/^[a-zA-Z()]*:\s*//')
git commit -m "build(ci): auto build for -> ${COMMIT_MSG} <-"
git push
else
echo "No changes to commit."
fi