Skip to content

Commit 1f2aa66

Browse files
committed
Prepare Linux v1.4.0
1 parent a9b1b2b commit 1f2aa66

3 files changed

Lines changed: 41 additions & 15 deletions

File tree

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
# 在 tag 推送时为 Linux x86_64 构建 AppImage 并附加到对应 release。
1+
# 从独立维护的 Linux 分支构建 x86_64 AppImage,并附加到已存在的共享 release。
22
#
3-
# 流程:release.sh(Mac)构建 macOS 双变体 + 建 release + 推 tag → 本 workflow 被 tag 触发 →
4-
# 在 swift:6.0-jammy 容器(glibc 2.35,覆盖 2022+ 发行版)里 checkout normal(含 Linux 源码)
5-
# → 跑 scripts/build-appimage.sh → 把 TokenClock-x86_64.AppImage + .sha256 附加到该 release。
6-
# 与 release.sh 之间是异步的(AppImage 约在发版后 5–10 分钟出现);softprops/action-gh-release
7-
# 的 create-or-update 语义避免「release 还没建好」的竞态。
3+
# linux-v1.4.0 映射到共享 release v1.4.0。构建源码和 workflow 都来自这个不可变的
4+
# Linux tag,因此 Linux catalog、路径和 GTK 界面无需并入 macOS normal/main 分支。
85
name: linux-appimage
96

107
on:
118
push:
12-
tags: ['v*']
13-
workflow_dispatch: # 允许手动触发,便于在不打 tag 时验证
9+
tags: ['linux-v*']
1410

1511
permissions:
1612
contents: write # 附加资产到 release 需要
@@ -21,10 +17,39 @@ jobs:
2117
container:
2218
image: swift:6.0-jammy
2319
steps:
24-
- name: Checkout normal branch (Linux sources + build script)
20+
- name: Checkout tagged Linux source
2521
uses: actions/checkout@v4
26-
with:
27-
ref: normal
22+
23+
- name: Map Linux tag to shared release tag
24+
id: release
25+
shell: bash
26+
run: |
27+
linux_tag='${{ github.ref_name }}'
28+
if [[ ! "$linux_tag" =~ ^linux-(v[0-9].*)$ ]]; then
29+
echo "Unexpected Linux tag: $linux_tag" >&2
30+
exit 1
31+
fi
32+
echo "tag=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
33+
34+
- name: Require an existing shared release
35+
shell: bash
36+
env:
37+
GH_TOKEN: ${{ github.token }}
38+
RELEASE_TAG: ${{ steps.release.outputs.tag }}
39+
run: |
40+
encoded_tag="${RELEASE_TAG//\//%2F}"
41+
api="https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$encoded_tag"
42+
for attempt in $(seq 1 20); do
43+
if curl -fsS \
44+
-H "Authorization: Bearer $GH_TOKEN" \
45+
-H "Accept: application/vnd.github+json" \
46+
"$api" >/dev/null; then
47+
exit 0
48+
fi
49+
sleep 15
50+
done
51+
echo "Shared release $RELEASE_TAG does not exist" >&2
52+
exit 1
2853
2954
- name: Build AppImage
3055
run: |
@@ -34,7 +59,8 @@ jobs:
3459
- name: Attach AppImage + SHA256 to the release
3560
uses: softprops/action-gh-release@v2
3661
with:
37-
tag_name: ${{ github.ref_name }}
62+
tag_name: ${{ steps.release.outputs.tag }}
63+
fail_on_unmatched_files: true
3864
files: |
3965
TokenClock-x86_64.AppImage
4066
TokenClock-x86_64.AppImage.sha256

‎Sources/TokenClock/Linux/LinuxApp.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,9 @@ final class LinuxApp: @unchecked Sendable {
478478
case "about":
479479
if let window {
480480
if let path = Bundle.module.path(forResource: "glass_disc", ofType: "png") {
481-
path.withCString { tc_gtk_show_about(window, "v1.3.8", $0) }
481+
path.withCString { tc_gtk_show_about(window, "v1.4.0", $0) }
482482
} else {
483-
tc_gtk_show_about(window, "v1.3.8", nil)
483+
tc_gtk_show_about(window, "v1.4.0", nil)
484484
}
485485
}
486486
case "quit":

‎Sources/TokenClock/Views/AboutView.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct AboutView: View {
55
let onDone: () -> Void
66

77
// ⚠️ 发版时同步版本号(与 cli/install.sh 的 RELEASE_TAG、cli/tokenclock 的 CLI_VERSION 一致)
8-
private let version = "v1.3.8"
8+
private let version = "v1.4.0"
99
private let issuesURL = URL(string: "https://github.com/Neo-Isshin/TokenClock/issues")!
1010
// 作者 GitHub 头像(置顶居中展示)。github.com/<user>.png 会 302 跳转到 avatars.githubusercontent.com 的真实头像。
1111
private let avatarURL = URL(string: "https://github.com/Neo-Isshin.png")!

0 commit comments

Comments
 (0)