Skip to content

test ci

test ci #89

Workflow file for this run

name: Build and Release
on:
push:
tags:
- '[0-9]+.*'
branches:
- master
paths:
- 'src/**'
- 'radical.schema.yaml'
- 'radical_pinyin.schema.yaml'
# 3. 允许手动触发
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Update tag
if: startsWith(github.ref, 'refs/tags/')
run: |
DATE=$(date +'%Y.%m.%d')
echo "${{ github.ref_name }}"
# 将版本信息追加到 dict-head-note.yaml
echo "# v${{ github.ref_name }} -> $DATE" >> src/dict/dict-head-note.yaml
# 更新 schema 文件中的版本信息
sed -i "s/version: \"[0-9]\.[0-9]\.[0-9]\"/version: \"${{ github.ref_name }}\"/g" radical.schema.yaml
sed -i "s/version: \"[0-9]\.[0-9]\.[0-9]\"/version: \"${{ github.ref_name }}\"/g" radical_pinyin.schema.yaml
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
cache: 'pip'
- name: Build
working-directory: ./src
run: |
make lint
make
- name: Push and pack
run: |
set -e
COMMIT_INFO=$(curl -s https://whatthecommit.com/index.txt)
echo "$(git status --porcelain)"
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
echo "Push to changes"
git add --all
git commit -m "$COMMIT_INFO"
git push origin HEAD:master
else
echo "No changes to commit"
fi
zip radical_pinyin.zip radical_pinyin.schema.yaml radical_pinyin.dict.yaml
zip radical_flypy.zip radical_flypy.dict.yaml radical.schema.yaml
zip -r extra.zip lua build
- name: Create nightly release
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v2
with:
body: |
## 文件
- `radical_pinyin.zip` : 包含全拼双拼的方案和词库
- `radical_flypy.zip`:仅适用于小鹤双拼的方案和词库
- `extra.zip`:辅码反查 lua 和带声调的 build 文件
tag_name: nightly
name: "nightly build"
make_latest: true
prerelease: false
generate_release_notes: true
fail_on_unmatched_files: true
files: |
radical_pinyin.zip
radical_flypy.zip
extra.zip
- name: Create stable release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
body: |
## 文件
- `radical_pinyin.zip` : 包含全拼双拼的方案和词库
- `radical_flypy.zip`:仅适用于小鹤双拼的方案和词库
- `extra.zip`:辅码反查 lua 和带声调的 build 文件
generate_release_notes: true
draft: false
prerelease: false
make_latest: true
fail_on_unmatched_files: true
files: |
radical_pinyin.zip
radical_flypy.zip
extra.zip