Skip to content

Commit 73a2dc9

Browse files
committed
Add MIT License, update README for DanceKunKun, and create Homebrew update workflow
1 parent 7328c0d commit 73a2dc9

File tree

3 files changed

+232
-22
lines changed

3 files changed

+232
-22
lines changed

.github/workflows/update-homebrew.yml

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Update Homebrew Tap
2+
3+
on:
4+
release:
5+
types: [published, edited, released]
6+
push:
7+
tags:
8+
- 'v*'
9+
10+
jobs:
11+
update-tap:
12+
runs-on: macos-latest
13+
steps:
14+
- name: Checkout tap
15+
uses: actions/checkout@v4
16+
with:
17+
repository: ygsgdbd/homebrew-tap
18+
token: ${{ secrets.TAP_TOKEN }}
19+
path: homebrew-tap
20+
21+
- name: Get release info
22+
id: release
23+
run: |
24+
# 获取版本号(移除 v 前缀如果存在)
25+
VERSION=${GITHUB_REF#refs/tags/}
26+
VERSION=${VERSION#v}
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
28+
29+
# 构建下载 URL 并验证文件是否存在
30+
DOWNLOAD_URL="https://github.com/ygsgdbd/DanceKunKun/releases/download/${GITHUB_REF#refs/tags/}/DanceKunKun.dmg"
31+
HTTP_STATUS=$(curl -L -s -o DanceKunKun.dmg -w "%{http_code}" "$DOWNLOAD_URL")
32+
33+
if [ "$HTTP_STATUS" != "200" ]; then
34+
echo "::error::Failed to download DMG file. HTTP status: $HTTP_STATUS"
35+
exit 1
36+
fi
37+
38+
# 计算 SHA256
39+
SHA256=$(shasum -a 256 DanceKunKun.dmg | cut -d ' ' -f 1)
40+
if [ -z "$SHA256" ]; then
41+
echo "::error::Failed to calculate SHA256"
42+
exit 1
43+
fi
44+
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
45+
46+
# 输出信息用于调试
47+
echo "Version: $VERSION"
48+
echo "SHA256: $SHA256"
49+
50+
- name: Verify tap directory
51+
run: |
52+
cd homebrew-tap
53+
mkdir -p Casks
54+
if [ ! -d "Casks" ]; then
55+
echo "::error::Failed to create Casks directory"
56+
exit 1
57+
fi
58+
59+
- name: Update formula
60+
run: |
61+
cd homebrew-tap
62+
cat > Casks/dancekunkun.rb << EOL
63+
cask "dancekunkun" do
64+
version "${{ steps.release.outputs.version }}"
65+
sha256 "${{ steps.release.outputs.sha256 }}"
66+
67+
url "https://github.com/ygsgdbd/DanceKunKun/releases/download/v#{version}/DanceKunKun.dmg"
68+
name "DanceKunKun"
69+
desc "A fun macOS menu bar app featuring a dancing Cai Xukun that grooves to your CPU usage"
70+
homepage "https://github.com/ygsgdbd/DanceKunKun"
71+
72+
auto_updates false
73+
depends_on macos: ">= :ventura"
74+
75+
app "DanceKunKun.app"
76+
77+
zap trash: [
78+
"~/Library/Application Support/DanceKunKun",
79+
"~/Library/Preferences/top.ygsgdbd.DanceKunKun.plist",
80+
"~/Library/Caches/top.ygsgdbd.DanceKunKun"
81+
]
82+
end
83+
EOL
84+
85+
- name: Verify formula
86+
run: |
87+
cd homebrew-tap
88+
if [ ! -f "Casks/dancekunkun.rb" ]; then
89+
echo "::error::Formula file was not created"
90+
exit 1
91+
fi
92+
93+
# 简单的语法检查
94+
ruby -c Casks/dancekunkun.rb || {
95+
echo "::error::Ruby syntax check failed"
96+
exit 1
97+
}
98+
99+
- name: Commit and push changes
100+
run: |
101+
cd homebrew-tap
102+
git config user.name "GitHub Action Bot"
103+
git config user.email "github-actions[bot]@users.noreply.github.com"
104+
105+
# 检查是否有变更
106+
if git diff --quiet; then
107+
echo "No changes to commit"
108+
exit 0
109+
fi
110+
111+
git add Casks/dancekunkun.rb
112+
git commit -m "Update dancekunkun to ${{ steps.release.outputs.version }}"
113+
114+
# 添加重试逻辑
115+
MAX_RETRIES=3
116+
RETRY_COUNT=0
117+
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
118+
if git push; then
119+
echo "Successfully pushed changes"
120+
exit 0
121+
fi
122+
RETRY_COUNT=$((RETRY_COUNT+1))
123+
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
124+
echo "Push failed, retrying in 5 seconds..."
125+
sleep 5
126+
fi
127+
done
128+
129+
echo "::error::Failed to push changes after $MAX_RETRIES attempts"
130+
exit 1

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 DanceKunKun Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+81-22
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,97 @@
1-
# RunKunKun
1+
# DanceKunKun
22

3-
一个 macOS 状态栏工具,用于显示输入法切换动画。
3+
[English](#english) | [中文](#中文)
44

5-
## 系统要求
5+
## English
66

7-
- macOS 13.0 或更高版本
8-
- Xcode 15.0 或更高版本
9-
- Tuist
7+
A fun macOS menu bar app featuring a dancing Cai Xukun that grooves to your CPU usage!
8+
9+
### Features
10+
11+
- Lives in your menu bar
12+
- Dancing animation speed changes with CPU usage
13+
- Universal Binary (supports both Apple Silicon and Intel Macs)
14+
- Dark mode support
15+
- Localization support (Simplified Chinese, Traditional Chinese, English)
16+
17+
### Requirements
1018

11-
## 开发环境设置
19+
- macOS 13.0 or later
20+
- Apple Silicon or Intel Mac
1221

13-
1. 安装 Tuist:
22+
### Installation
23+
24+
1. Download the latest `DanceKunKun.dmg` from [Releases](../../releases)
25+
2. Open the DMG file
26+
3. Drag DanceKunKun to your Applications folder
27+
4. Launch DanceKunKun from Applications
28+
5. Enjoy the dance! 🕺
29+
30+
### Build from Source
31+
32+
1. Install [Tuist](https://tuist.io):
1433
```bash
1534
curl -Ls https://install.tuist.io | bash
1635
```
1736

18-
2. 生成 Xcode 项目:
37+
2. Clone the repository:
38+
```bash
39+
git clone https://github.com/yourusername/DanceKunKun.git
40+
cd DanceKunKun
41+
```
42+
43+
3. Generate Xcode project:
1944
```bash
2045
tuist generate
2146
```
2247

23-
## 项目结构
48+
4. Open the project and build
49+
50+
## 中文
51+
52+
一个有趣的 macOS 菜单栏应用,会随着 CPU 使用率跳舞的蔡徐坤!
53+
54+
### 功能特点
55+
56+
- 常驻菜单栏
57+
- 舞蹈速度随 CPU 使用率变化
58+
- 通用二进制(同时支持 Apple Silicon 和 Intel Mac)
59+
- 支持深色模式
60+
- 支持本地化(简体中文、繁体中文、英文)
61+
62+
### 系统要求
63+
64+
- macOS 13.0 或更高版本
65+
- Apple Silicon 或 Intel Mac
66+
67+
### 安装方法
68+
69+
1.[Releases](../../releases) 页面下载最新的 `DanceKunKun.dmg`
70+
2. 打开 DMG 文件
71+
3. 将 DanceKunKun 拖到应用程序文件夹
72+
4. 从应用程序文件夹启动 DanceKunKun
73+
5. 享受舞蹈吧!🕺
74+
75+
### 从源码构建
76+
77+
1. 安装 [Tuist](https://tuist.io)
78+
```bash
79+
curl -Ls https://install.tuist.io | bash
80+
```
81+
82+
2. 克隆仓库:
83+
```bash
84+
git clone https://github.com/yourusername/DanceKunKun.git
85+
cd DanceKunKun
86+
```
87+
88+
3. 生成 Xcode 项目:
89+
```bash
90+
tuist generate
91+
```
2492

25-
- `Sources/App`: 应用程序入口和主要配置
26-
- `Sources/Views`: SwiftUI 视图文件
27-
- `Sources/Models`: 数据模型
28-
- `Sources/Utils`: 工具类和扩展
29-
- `Resources`: 资源文件
30-
- `Tests`: 单元测试
93+
4. 打开项目并构建
3194

32-
## 使用的框架
95+
## License
3396

34-
- SwiftUI
35-
- SwiftUIX
36-
- Defaults
37-
- SwifterSwift
38-
- KeyboardShortcuts
97+
MIT License

0 commit comments

Comments
 (0)