Skip to content

Commit 3dd0b6a

Browse files
committed
feat: add req count
1 parent dcf7bb5 commit 3dd0b6a

File tree

5 files changed

+401
-5
lines changed

5 files changed

+401
-5
lines changed

.github/workflows/packycode-macos.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,25 @@ jobs:
6666
with:
6767
python-version: '3.11'
6868

69+
- name: Write VERSION from tag/input (if provided)
70+
shell: bash
71+
run: |
72+
set -euo pipefail
73+
DIR="${{ steps.wd.outputs.dir }}"
74+
TAG=""
75+
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
76+
TAG="${{ github.ref_name }}"
77+
elif [[ -n "${{ inputs.tag }}" ]]; then
78+
TAG="${{ inputs.tag }}"
79+
fi
80+
if [[ -n "$TAG" ]]; then
81+
VER="${TAG#v}"
82+
echo "$VER" > "$DIR/VERSION"
83+
echo "VERSION=$VER";
84+
else
85+
echo "No tag/input provided; keeping existing VERSION file if present.";
86+
fi
87+
6988
- name: Cache pip
7089
uses: actions/cache@v4
7190
with:
@@ -115,6 +134,11 @@ jobs:
115134
run: |
116135
ditto -c -k --sequesterRsrc --keepParent PackyCode.app PackyCode-macOS.zip
117136
137+
- name: Generate SHA256
138+
working-directory: ${{ steps.wd.outputs.dir }}/dist
139+
run: |
140+
shasum -a 256 PackyCode-macOS.zip > PackyCode-macOS.zip.sha256
141+
118142
- name: Prepare release metadata
119143
id: relmeta
120144
run: |
@@ -134,6 +158,7 @@ jobs:
134158
name: PackyCode-macOS
135159
path: |
136160
${{ steps.wd.outputs.dir }}/dist/PackyCode-macOS.zip
161+
${{ steps.wd.outputs.dir }}/dist/PackyCode-macOS.zip.sha256
137162
138163
- name: Publish GitHub Release
139164
if: inputs.publish == 'true' || startsWith(github.ref, 'refs/tags/')
@@ -143,6 +168,7 @@ jobs:
143168
name: ${{ inputs.release_name != '' && inputs.release_name || env.REL_TAG }}
144169
files: |
145170
${{ steps.wd.outputs.dir }}/dist/PackyCode-macOS.zip
171+
${{ steps.wd.outputs.dir }}/dist/PackyCode-macOS.zip.sha256
146172
target_commitish: ${{ github.sha }}
147173
generate_release_notes: true
148174
make_latest: ${{ inputs.make_latest != '' && inputs.make_latest || 'true' }}

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
- 设置 Token(支持 JWT 或 API Key,均使用 Bearer 头)
2121
- 标题格式:百分比 或 自定义模板
2222
- 刷新/隐藏标题/打开控制台/延迟监控(测速:https://packy.te.sb/)/推广(PackyCode / Codex)
23+
- 检查更新:对比 GitHub 最新 release 的 tag 与本地版本
24+
- 在线更新:直接下载最新 release 的 macOS 压缩包并替换 .app 后重启
2325

2426
## 运行
2527
```bash
@@ -79,10 +81,27 @@ python3 setup.py py2app
7981
"hidden": false,
8082
"poll_interval": 180,
8183
"title_mode": "percent | custom",
82-
"title_custom": "D {d_pct}% | M {m_pct}%"
84+
"title_custom": "D {d_pct}% | M {m_pct}%",
85+
"update_repo": "owner/repo",
86+
"update_expected_team_id": ""
8387
}
8488
```
8589

90+
检查更新:
91+
-`update_repo` 填写你的 GitHub 仓库 `owner/repo`(例如 `packycode/packycode`
92+
- 菜单中点击“检查更新”,会调用 GitHub Releases API 比较最新 `tag_name` 与当前版本,若有新版本会提示并可跳转至发布页下载
93+
94+
在线更新:
95+
- 同样需要配置 `update_repo`
96+
- 点击“在线更新”,会下载最新 release 的 zip,解压并自动替换本机正在使用的 `.app`(通过临时脚本在退出后替换),随后自动重启应用;若当前以源码方式运行,会打开 Finder 供你手动拖拽替换。
97+
- 安全校验:
98+
- 若 Release 同时提供 `.sha256`/`.sha256sum`/`sha256.txt`,会自动核对压缩包 SHA256,不匹配则中止
99+
- 下载后校验签名:优先运行 `codesign --verify``spctl --assess`;如在配置中设置 `update_expected_team_id`(Apple TeamIdentifier),会强制比对,不匹配则中止;若未配置但校验失败,会提示风险并让你确认是否继续
100+
101+
版本号来源:
102+
- 打包环境优先从 `.app/Contents/Info.plist``CFBundleShortVersionString` 读取
103+
- 源码环境读取仓库根的 `VERSION` 文件;`setup.py` 也从该文件读取版本,避免手动同步
104+
86105
## 已知限制
87106
- 运行环境需 macOS(依赖 rumps/pyobjc)
88107
- 本地无法读取浏览器 Cookie,因此需要手动粘贴 JWT 或 API Key

VERSION

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

0 commit comments

Comments
 (0)