Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: Build and Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v1.0.0)'
required: true
default: 'v1.0.0'

jobs:
build-windows:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller

- name: Build Windows executable
run: |
pyinstaller --onefile --name "AutoClickerPro" --icon=NONE --add-data "config;config" --add-data "core;core" --add-data "ui;ui" --add-data "utils;utils" main.py
shell: pwsh

- name: Create Windows release package
run: |
New-Item -ItemType Directory -Force -Path release
Copy-Item dist\AutoClickerPro.exe release\
Copy-Item README.md release\
Copy-Item LICENSE release\ 2>$null || echo "No LICENSE file"
Compress-Archive -Path release\* -DestinationPath AutoClickerPro_Windows.zip -Force
shell: pwsh

- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: windows-build
path: AutoClickerPro_Windows.zip

build-linux:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller

- name: Build Linux executable
run: |
pyinstaller --onefile --name "AutoClickerPro" --icon=NONE --add-data "config:config" --add-data "core:core" --add-data "ui:ui" --add-data "utils:utils" main.py

- name: Create Linux release package
run: |
mkdir -p release
cp dist/AutoClickerPro release/
cp README.md release/
cp LICENSE release/ 2>/dev/null || echo "No LICENSE file"
cd release && tar -czvf ../AutoClickerPro_Linux.tar.gz *

- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: linux-build
path: AutoClickerPro_Linux.tar.gz

create-release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'

steps:
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: windows-build
path: ./artifacts

- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: linux-build
path: ./artifacts

- name: Get version from tag or input
id: get_version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${{ github.ref_name }}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Generate changelog
id: changelog
run: |
cat > changelog.md << 'EOF'
## 🎉 自动点击器专业版 ${{ steps.get_version.outputs.version }}

### ✨ 新特性
- 🔐 **加密存储**: 宏录制文件采用 Fernet 对称加密,安全保护您的操作序列
- 🧩 **模块化架构**: UI 与业务逻辑完全解耦,代码更易维护
- ⚡ **高性能**: 优化的线程管理,低延迟响应
- 🛡️ **安全防护**: 完整的输入验证和防滥用机制
- 🎨 **现代化界面**: 简洁直观的用户体验

### 🔧 技术改进
- 分离配置文件 (constants/encryption/validation)
- 新增宏管理模块 (macros.py)
- 快捷键管理器 (hotkey_manager.py)
- 完整的单元测试覆盖 (36+ 测试用例)
- CI/CD 自动化构建

### 📦 安装说明
#### Windows
1. 下载 `AutoClickerPro_Windows.zip`
2. 解压到任意目录
3. 双击运行 `AutoClickerPro.exe`

#### Linux
1. 下载 `AutoClickerPro_Linux.tar.gz`
2. 解压:`tar -xzvf AutoClickerPro_Linux.tar.gz`
3. 运行:`./AutoClickerPro`

### ⌨️ 快捷键
- `F8`: 开始/停止连点
- `F9`: 开始/停止录制
- `F10`: 播放宏
- `ESC`: 停止当前操作

### 📝 更新日志
- 首次正式发布
- 支持鼠标连点和键盘宏录制
- 加密存储保护隐私
- 跨平台支持 (Windows/Linux)
EOF
cat changelog.md

- name: Create Release
uses: softprops/action-gh-release@v1
with:
Comment on lines +162 to +164
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Grant release job write permission

In repositories or organizations where the default GITHUB_TOKEN permission is read-only, this release step will fail with a permissions error because the workflow never requests write access. The softprops/action-gh-release documentation lists permissions: contents: write as required for the GitHub integration token, so add that at the workflow or create-release job level before calling the action.

Useful? React with 👍 / 👎.

name: 自动点击器专业版 ${{ steps.get_version.outputs.version }}
body_path: changelog.md
files: |
Comment on lines +164 to +167
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Wire manual releases to the requested tag

When this workflow is run via workflow_dispatch, the entered version is only used in the release title/body; softprops/action-gh-release documents tag_name as defaulting to the triggering ref (github.ref_name/GITHUB_REF), and GitHub documents workflow_dispatch as running on the selected branch or tag. As a result, using the advertised manual flow from main will create/update a release for main rather than the requested v1.0.0, so the uploaded binaries are attached to the wrong release unless the user manually dispatches from an existing tag. Pass tag_name: ${{ steps.get_version.outputs.version }} (and appropriate target_commitish) here.

Useful? React with 👍 / 👎.

./artifacts/AutoClickerPro_Windows.zip
./artifacts/AutoClickerPro_Linux.tar.gz
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106 changes: 66 additions & 40 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,57 +1,83 @@
```
# Python
# Compiled and build artifacts
*.pyc
__pycache__/
*.o
*.obj
*.class
*.exe
*.dll
*.so
*.a
*.out

# Dependencies
node_modules/
venv/
.venv/
.env
.env.local
.env.*

# Build directories
dist/
build/
target/
.gradle/

# Python specific
*.pyc
__pycache__/
*.pyo
*.pyd
.Python
env/
venv/
.venv/
.ENV
.python-version

# Testing
*.so
.Pytest_cache/
.mypy_cache/
.coverage
htmlcov/
.coverage.*
.cache
.pytest_cache/
.hypothesis/

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# IDEs
# Logs and temp files
*.log
*.tmp
*.swp
*.swo

# Editors
.vscode/
.idea/
*.swp
*.swo

# Logs
*.log

# Environment variables
.env
.env.local
*.env.*

# OS generated files
.DS_Store
Thumbs.db

# Coverage reports
coverage/
htmlcov/
*.coverage

# Compressed files
*.zip
*.gz
*.tar
*.tgz
*.bz2
*.xz
*.7z
*.rar
*.zst
*.lz4
*.lzh
*.cab
*.arj
*.rpm
*.deb
*.Z
*.lz
*.lzo
*.tar.gz
*.tar.bz2
*.tar.xz
*.tar.zst
```
38 changes: 38 additions & 0 deletions AutoClickerPro.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- mode: python ; coding: utf-8 -*-


a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=['pynput.mouse', 'pynput.keyboard', 'cryptography.fernet'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='AutoClickerPro',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
Loading