Skip to content

Commit

Permalink
Add MIT License, update README for DanceKunKun, and create Homebrew u…
Browse files Browse the repository at this point in the history
…pdate workflow
  • Loading branch information
ygsgdbd committed Dec 10, 2024
1 parent 7328c0d commit 73a2dc9
Show file tree
Hide file tree
Showing 3 changed files with 232 additions and 22 deletions.
130 changes: 130 additions & 0 deletions .github/workflows/update-homebrew.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Update Homebrew Tap

on:
release:
types: [published, edited, released]
push:
tags:
- 'v*'

jobs:
update-tap:
runs-on: macos-latest
steps:
- name: Checkout tap
uses: actions/checkout@v4
with:
repository: ygsgdbd/homebrew-tap
token: ${{ secrets.TAP_TOKEN }}
path: homebrew-tap

- name: Get release info
id: release
run: |
# 获取版本号(移除 v 前缀如果存在)
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
# 构建下载 URL 并验证文件是否存在
DOWNLOAD_URL="https://github.com/ygsgdbd/DanceKunKun/releases/download/${GITHUB_REF#refs/tags/}/DanceKunKun.dmg"
HTTP_STATUS=$(curl -L -s -o DanceKunKun.dmg -w "%{http_code}" "$DOWNLOAD_URL")
if [ "$HTTP_STATUS" != "200" ]; then
echo "::error::Failed to download DMG file. HTTP status: $HTTP_STATUS"
exit 1
fi
# 计算 SHA256
SHA256=$(shasum -a 256 DanceKunKun.dmg | cut -d ' ' -f 1)
if [ -z "$SHA256" ]; then
echo "::error::Failed to calculate SHA256"
exit 1
fi
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
# 输出信息用于调试
echo "Version: $VERSION"
echo "SHA256: $SHA256"
- name: Verify tap directory
run: |
cd homebrew-tap
mkdir -p Casks
if [ ! -d "Casks" ]; then
echo "::error::Failed to create Casks directory"
exit 1
fi
- name: Update formula
run: |
cd homebrew-tap
cat > Casks/dancekunkun.rb << EOL
cask "dancekunkun" do
version "${{ steps.release.outputs.version }}"
sha256 "${{ steps.release.outputs.sha256 }}"
url "https://github.com/ygsgdbd/DanceKunKun/releases/download/v#{version}/DanceKunKun.dmg"
name "DanceKunKun"
desc "A fun macOS menu bar app featuring a dancing Cai Xukun that grooves to your CPU usage"
homepage "https://github.com/ygsgdbd/DanceKunKun"
auto_updates false
depends_on macos: ">= :ventura"
app "DanceKunKun.app"
zap trash: [
"~/Library/Application Support/DanceKunKun",
"~/Library/Preferences/top.ygsgdbd.DanceKunKun.plist",
"~/Library/Caches/top.ygsgdbd.DanceKunKun"
]
end
EOL
- name: Verify formula
run: |
cd homebrew-tap
if [ ! -f "Casks/dancekunkun.rb" ]; then
echo "::error::Formula file was not created"
exit 1
fi
# 简单的语法检查
ruby -c Casks/dancekunkun.rb || {
echo "::error::Ruby syntax check failed"
exit 1
}
- name: Commit and push changes
run: |
cd homebrew-tap
git config user.name "GitHub Action Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
# 检查是否有变更
if git diff --quiet; then
echo "No changes to commit"
exit 0
fi
git add Casks/dancekunkun.rb
git commit -m "Update dancekunkun to ${{ steps.release.outputs.version }}"
# 添加重试逻辑
MAX_RETRIES=3
RETRY_COUNT=0
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
if git push; then
echo "Successfully pushed changes"
exit 0
fi
RETRY_COUNT=$((RETRY_COUNT+1))
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
echo "Push failed, retrying in 5 seconds..."
sleep 5
fi
done
echo "::error::Failed to push changes after $MAX_RETRIES attempts"
exit 1
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 DanceKunKun Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
103 changes: 81 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,97 @@
# RunKunKun
# DanceKunKun

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

## 系统要求
## English

- macOS 13.0 或更高版本
- Xcode 15.0 或更高版本
- Tuist
A fun macOS menu bar app featuring a dancing Cai Xukun that grooves to your CPU usage!

### Features

- Lives in your menu bar
- Dancing animation speed changes with CPU usage
- Universal Binary (supports both Apple Silicon and Intel Macs)
- Dark mode support
- Localization support (Simplified Chinese, Traditional Chinese, English)

### Requirements

## 开发环境设置
- macOS 13.0 or later
- Apple Silicon or Intel Mac

1. 安装 Tuist:
### Installation

1. Download the latest `DanceKunKun.dmg` from [Releases](../../releases)
2. Open the DMG file
3. Drag DanceKunKun to your Applications folder
4. Launch DanceKunKun from Applications
5. Enjoy the dance! 🕺

### Build from Source

1. Install [Tuist](https://tuist.io):
```bash
curl -Ls https://install.tuist.io | bash
```

2. 生成 Xcode 项目:
2. Clone the repository:
```bash
git clone https://github.com/yourusername/DanceKunKun.git
cd DanceKunKun
```

3. Generate Xcode project:
```bash
tuist generate
```

## 项目结构
4. Open the project and build

## 中文

一个有趣的 macOS 菜单栏应用,会随着 CPU 使用率跳舞的蔡徐坤!

### 功能特点

- 常驻菜单栏
- 舞蹈速度随 CPU 使用率变化
- 通用二进制(同时支持 Apple Silicon 和 Intel Mac)
- 支持深色模式
- 支持本地化(简体中文、繁体中文、英文)

### 系统要求

- macOS 13.0 或更高版本
- Apple Silicon 或 Intel Mac

### 安装方法

1.[Releases](../../releases) 页面下载最新的 `DanceKunKun.dmg`
2. 打开 DMG 文件
3. 将 DanceKunKun 拖到应用程序文件夹
4. 从应用程序文件夹启动 DanceKunKun
5. 享受舞蹈吧!🕺

### 从源码构建

1. 安装 [Tuist](https://tuist.io)
```bash
curl -Ls https://install.tuist.io | bash
```

2. 克隆仓库:
```bash
git clone https://github.com/yourusername/DanceKunKun.git
cd DanceKunKun
```

3. 生成 Xcode 项目:
```bash
tuist generate
```

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

## 使用的框架
## License

- SwiftUI
- SwiftUIX
- Defaults
- SwifterSwift
- KeyboardShortcuts
MIT License

0 comments on commit 73a2dc9

Please sign in to comment.