Skip to content

Commit 1c3eb8c

Browse files
committed
【新增,配置】添加 GitHub Actions 自动发布工作流和英文文档
添加 GitHub Actions 测试工作流,实现版本检查、字体编译和产物上传功能 创建英文版 README 文档,分离中英文内容以改善阅读体验 新增版本文件 VERSION 和版本检查脚本 scripts/is-newer-version.bash 优化构建脚本 build_font_from_bdf.py 的字符输出逻辑 更新 .gitignore 忽略 AI 辅助文件
1 parent de4020d commit 1c3eb8c

10 files changed

Lines changed: 316 additions & 77 deletions

File tree

.github/workflows/release.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: 自动发行版本
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pages: write
15+
id-token: write
16+
name: 发行新版本
17+
steps:
18+
- name: 检出代码
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: 检查版本
24+
id: version-check
25+
run: |
26+
VERSION=$(./scripts/is-newer-version.bash)
27+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
28+
if [ "$VERSION" != "0" ]; then
29+
echo "检测到新版本: $VERSION"
30+
else
31+
echo "没有新版本需要发行"
32+
fi
33+
34+
- name: 推送标签
35+
if: steps.version-check.outputs.version != '0'
36+
id: push-tag
37+
run: |
38+
tag="v${{ steps.version-check.outputs.version }}"
39+
git config user.name "${GITHUB_ACTOR}"
40+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
41+
git tag -a "${tag}" -m "Release ${tag}"
42+
git push origin "${tag}"
43+
echo "tag_name=${tag}" >> $GITHUB_OUTPUT
44+
45+
- name: 配置环境
46+
if: steps.version-check.outputs.version != '0'
47+
run: |
48+
# 安装 Python 依赖
49+
python3 -m pip install --upgrade pip
50+
pip3 install -r requirements.txt
51+
52+
# 安装构建依赖
53+
sudo apt-get update
54+
sudo apt-get install -y build-essential wget tar gzip
55+
56+
- name: 编译字体
57+
if: steps.version-check.outputs.version != '0'
58+
run: |
59+
# 运行构建脚本
60+
bash build.bash
61+
62+
# 验证输出文件
63+
if [ ! -f "output/xibo.psfu.gz" ]; then
64+
echo "错误:字体文件生成失败"
65+
exit 1
66+
fi
67+
68+
# 显示文件信息
69+
ls -la output/xibo.psfu.gz
70+
71+
- name: 创建 GitHub Release
72+
if: steps.version-check.outputs.version != '0'
73+
uses: ncipollo/release-action@v1
74+
with:
75+
generateReleaseNotes: true
76+
tag: "v${{ steps.version-check.outputs.version }}"
77+
artifacts: "output/xibo.psfu.gz,output/xibo.psf,output/xibo.txt"
78+
79+
- name: 删除标签(如果失败)
80+
if: (cancelled() || failure()) && steps.push-tag.outputs.tag_name != ''
81+
run: |
82+
git config user.name "${GITHUB_ACTOR}"
83+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
84+
git push --delete origin "${{ steps.push-tag.outputs.tag_name }}"
85+
git tag -d "${{ steps.push-tag.outputs.tag_name }}"

.github/workflows/test.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: 【测试】自动发行版本
2+
3+
on:
4+
workflow_dispatch:
5+
# push:
6+
# branches:
7+
# - master
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pages: write
15+
id-token: write
16+
name: 【测试】发行新版本的发行
17+
steps:
18+
- name: 检出代码
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: 检查版本
24+
id: version-check
25+
run: |
26+
VERSION=$(./scripts/is-newer-version.bash)
27+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
28+
if [ "$VERSION" != "0" ]; then
29+
echo "检测到新版本: $VERSION"
30+
else
31+
echo "没有新版本需要发行"
32+
fi
33+
34+
# - name: 推送标签
35+
# if: steps.version-check.outputs.version != '0'
36+
# id: push-tag
37+
# run: |
38+
# tag="v${{ steps.version-check.outputs.version }}"
39+
# git config user.name "${GITHUB_ACTOR}"
40+
# git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
41+
# git tag -a "${tag}" -m "Release ${tag}"
42+
# git push origin "${tag}"
43+
# echo "tag_name=${tag}" >> $GITHUB_OUTPUT
44+
45+
- name: 配置环境
46+
if: steps.version-check.outputs.version != '0'
47+
run: |
48+
# 安装 Python 依赖
49+
python3 -m pip install --upgrade pip
50+
pip3 install -r requirements.txt
51+
52+
# 安装构建依赖
53+
sudo apt-get update
54+
sudo apt-get install -y build-essential wget tar gzip
55+
56+
- name: 编译字体
57+
if: steps.version-check.outputs.version != '0'
58+
run: |
59+
# 运行构建脚本
60+
bash build.bash
61+
62+
# 验证输出文件
63+
if [ ! -f "output/xibo.psfu.gz" ]; then
64+
echo "错误:字体文件生成失败"
65+
exit 1
66+
fi
67+
68+
# 显示文件信息
69+
ls -la output/xibo.psfu.gz
70+
71+
- name: Upload artifact
72+
if: (cancelled() || failure() || success())
73+
uses: actions/upload-artifact@v4
74+
with:
75+
path: output/*
76+
compression-level: 9 # maximum compression
77+
retention-days: 5
78+
79+
# - name: 创建 GitHub Release
80+
# if: steps.version-check.outputs.version != '0'
81+
# uses: ncipollo/release-action@v1
82+
# with:
83+
# generateReleaseNotes: true
84+
# tag: "v${{ steps.version-check.outputs.version }}"
85+
# artifacts: "output/xibo.psfu.gz"
86+
87+
# - name: 删除标签(如果失败)
88+
# if: (cancelled() || failure()) && steps.push-tag.outputs.tag_name != ''
89+
# run: |
90+
# git config user.name "${GITHUB_ACTOR}"
91+
# git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
92+
# git push --delete origin "${{ steps.push-tag.outputs.tag_name }}"
93+
# git tag -d "${{ steps.push-tag.outputs.tag_name }}"

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
/output/
33

44
# 忽略临时文件夹
5-
/temp/
5+
/temp/
6+
7+
QWEN.md
8+
CLAUDE.md

README.en.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# ![Demo](assets/display.png)
2+
3+
> [简体中文](README.md) | ENGLISH
4+
5+
## font-xibo
6+
7+
Xibo is a Chinese TTY font designed for Linux, aiming to provide Chinese display in TTY without installing kernel patches such as [cjktty](https://github.com/zhmars/cjktty-patches) or third-party software like [kmscon](http://www.freedesktop.org/wiki/Software/kmscon), [fbterm](https://salsa.debian.org/debian/fbterm), or [zhcon](https://zhcon.sourceforge.net/).
8+
9+
The inspiration for this project comes from the [syllazh](https://github.com/oldherl/syllazh/) font.
10+
11+
## Phonetic Characters
12+
13+
When using this font, you may notice that characters with similar pronunciations are displayed as the same character. For example, any of the characters "用永勇拥擁涌湧咏詠蛹雍踊庸踴泳" will be uniformly displayed as "用".
14+
15+
This is because fonts on Linux TTY are generally changed using the `setfont` tool from the kbd package, which supports a maximum of 512 glyphs. However, a single glyph can map to multiple Unicode code points.
16+
Therefore, Xibo maps all characters with the same pronunciation (ignoring tones) to the same glyph, allowing for Chinese character display within the limited number of glyphs.
17+
18+
## Building the Font
19+
20+
1. Clone the repository:
21+
22+
```shellscript
23+
git clone https://github.com/PJ-568/font-xibo.git
24+
cd font-xibo
25+
```
26+
27+
2. Install dependencies:
28+
29+
```shellscript
30+
pip install -r requirements.txt
31+
```
32+
33+
3. Build the font:
34+
35+
```shellscript
36+
bash build.bash
37+
```
38+
39+
During the build process, the script will install `psftools`, which is used to generate the font.
40+
41+
After building, a PSF2 font file named `xibo.psfu.gz` will be generated in the `output/` directory.
42+
43+
## Using the Font
44+
45+
> Ensure that the version of the `setfont` command is `2.6rc1` or higher.
46+
> Versions prior to `2.6rc1` do not support fonts larger than 65535 (approximately 64KB).
47+
> After `2.6rc1`, the limit has been relaxed to 4194304 (approximately 4MB).
48+
>
49+
> Run `setfont -V` to check the version.
50+
51+
Place `xibo.psfu.gz` in the `consolefonts` directory (located at `/usr/share/consolefonts/` on Debian and `/usr/share/kbd/consolefonts/` on Arch Linux), then execute `setfont xibo` to change the font or `setfont -d xibo` to switch to a double-sized font.
52+
53+
## License
54+
55+
> Thanks to the **WenQuanYi** team for providing the `WenQuanYi Bitmap Song v1.0.0-RC1 Hero` font.
56+
57+
The script files `build.bash` and `build_font_from_bdf.py` in this repository are licensed under the [GNU GENERAL PUBLIC LICENSE Version 3](LICENSE).
58+
All reference files in the `original/references/` directory are licensed under the [Unlicense](original/references/LICENSE).
59+
The generated font files in this project are licensed under the [Free Chinese Font License and GNU GENERAL PUBLIC LICENSE Version 2](FONT-LICENSE).
60+
61+
## Contributing
62+
63+
Refer to the [Contribution Guide](CONTRIBUTING.md).

README.md

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# ![演示](assets/display.png)
22

3-
## font-xibo
3+
> 简体中文 | [ENGLISH](README.en.md)
44
5-
<div style="display: flex; flex-direction: row; justify-content: space-between;">
6-
<div>
5+
## font-xibo
76

87
xibo 是一个为 Linux 设计的中文 TTY 字体,旨在在不安装诸如 [cjktty](https://github.com/zhmars/cjktty-patches) 等内核补丁且不安装 [kmscon](http://www.freedesktop.org/wiki/Software/kmscon)[fbterm](https://salsa.debian.org/debian/fbterm)[zhcon](https://zhcon.sourceforge.net/) 等第三方软件的环境下提供 TTY 中文显示。
98

@@ -53,72 +52,12 @@ xibo 是一个为 Linux 设计的中文 TTY 字体,旨在在不安装诸如 [c
5352

5453
## 许可协议
5554

55+
> 感谢**文泉驿**团队提供的`文泉驿点阵宋体 v1.0.0-RC1 英雄`字体。
56+
5657
本仓库中的脚本文件 `build.bash``build_font_from_bdf.py` 遵循 [GNU GENERAL PUBLIC LICENSE Version 3 许可协议](LICENSE)
5758
`original/references/` 目录下的所有参照文件遵循 [Unlicense 许可协议](original/references/LICENSE)
5859
本项目生成的字体文件遵循[自由中文字体和 GNU GENERAL PUBLIC LICENSE Version 2 许可协议](FONT-LICENSE)
5960

6061
## 做出贡献
6162

6263
请参照[贡献指北](CONTRIBUTING.md)
63-
64-
</div>
65-
<div>
66-
67-
Xibo is a Chinese TTY font designed for Linux, aiming to provide Chinese display in TTY without installing kernel patches such as [cjktty](https://github.com/zhmars/cjktty-patches) or third-party software like [kmscon](http://www.freedesktop.org/wiki/Software/kmscon), [fbterm](https://salsa.debian.org/debian/fbterm), or [zhcon](https://zhcon.sourceforge.net/).
68-
69-
The inspiration for this project comes from the [syllazh](https://github.com/oldherl/syllazh/) font.
70-
71-
## Phonetic Characters
72-
73-
When using this font, you may notice that characters with similar pronunciations are displayed as the same character. For example, any of the characters “用永勇拥擁涌湧咏詠蛹雍踊庸踴泳” will be uniformly displayed as “用”.
74-
75-
This is because fonts on Linux TTY are generally changed using the `setfont` tool from the kbd package, which supports a maximum of 512 glyphs. However, a single glyph can map to multiple Unicode code points.
76-
Therefore, Xibo maps all characters with the same pronunciation (ignoring tones) to the same glyph, allowing for Chinese character display within the limited number of glyphs.
77-
78-
## Building the Font
79-
80-
1. Clone the repository:
81-
82-
```shellscript
83-
git clone https://github.com/PJ-568/font-xibo.git
84-
cd font-xibo
85-
```
86-
87-
2. Install dependencies:
88-
89-
```shellscript
90-
pip install -r requirements.txt
91-
```
92-
93-
3. Build the font:
94-
95-
```shellscript
96-
bash build.bash
97-
```
98-
99-
During the build process, the script will install `psftools`, which is used to generate the font.
100-
101-
After building, a PSF2 font file named `xibo.psfu.gz` will be generated in the `output/` directory.
102-
103-
## Using the Font
104-
105-
> Ensure that the version of the `setfont` command is `2.6rc1` or higher.
106-
> Versions prior to `2.6rc1` do not support fonts larger than 65535 (approximately 64KB).
107-
> After `2.6rc1`, the limit has been relaxed to 4194304 (approximately 4MB).
108-
>
109-
> Run `setfont -V` to check the version.
110-
111-
Place `xibo.psfu.gz` in the `consolefonts` directory (located at `/usr/share/consolefonts/` on Debian and `/usr/share/kbd/consolefonts/` on Arch Linux), then execute `setfont xibo` to change the font or `setfont -d xibo` to switch to a double-sized font.
112-
113-
## License
114-
115-
The script files `build.bash` and `build_font_from_bdf.py` in this repository are licensed under the [GNU GENERAL PUBLIC LICENSE Version 3](LICENSE).
116-
All reference files in the `original/references/` directory are licensed under the [Unlicense](original/references/LICENSE).
117-
The generated font files in this project are licensed under the [Free Chinese Font License and GNU GENERAL PUBLIC LICENSE Version 2](FONT-LICENSE).
118-
119-
## Contributing
120-
121-
Refer to the [Contribution Guide](CONTRIBUTING.md).
122-
123-
</div>
124-
</div>

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

build.bash

100644100755
File mode changed.

0 commit comments

Comments
 (0)