66 tags :
77 - " v*"
88
9- env :
10- IS_PRERELEASE : ${{ contains(github.ref_name, '-') }}
11-
129jobs :
1310 # Create the release first, then all builds upload to it
1411 create-release :
@@ -59,11 +56,28 @@ jobs:
5956 working-directory : rs
6057 run : cargo build -p capslockx-windows -p clx-screen-reader --release
6158
62- - name : Stage release binaries
59+ - name : Package Windows installer zip
6360 shell : pwsh
6461 run : |
65- Copy-Item rs\target\release\clx-rust.exe clx-rust.exe
66- Copy-Item rs\target\release\clx-screen-reader.exe clx-screen-reader.exe
62+ $VERSION = "${{ github.ref_name }}"
63+ $STAGE = "CapsLockX"
64+ New-Item -ItemType Directory -Force -Path $STAGE
65+ Copy-Item rs\target\release\clx-rust.exe "$STAGE\clx.exe"
66+ Copy-Item rs\target\release\clx-screen-reader.exe "$STAGE\clx-screen-reader.exe"
67+ Copy-Item scripts\install.ps1 "$STAGE\install.ps1"
68+ # Create uninstaller
69+ @"
70+ # CapsLockX uninstaller
71+ `$InstallDir = "`$env:LOCALAPPDATA\CapsLockX"
72+ `$StartMenu = [Environment]::GetFolderPath("StartMenu")
73+ Remove-Item -Recurse -Force `$InstallDir -ErrorAction SilentlyContinue
74+ Remove-Item (Join-Path `$StartMenu "CapsLockX.lnk") -ErrorAction SilentlyContinue
75+ `$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
76+ `$NewPath = (`$UserPath -split ";" | Where-Object { `$_ -ne `$InstallDir }) -join ";"
77+ [Environment]::SetEnvironmentVariable("Path", `$NewPath, "User")
78+ Write-Host "CapsLockX uninstalled."
79+ "@ | Out-File -Encoding utf8 "$STAGE\uninstall.ps1"
80+ Compress-Archive -Path "$STAGE\*" -DestinationPath "CapsLockX-windows-x86_64.zip"
6781
6882 # Commit binaries back to main only for stable releases
6983 - name : Commit binaries to main
@@ -73,14 +87,17 @@ jobs:
7387 git checkout main
7488 git config user.name "github-actions[bot]"
7589 git config user.email "github-actions[bot]@users.noreply.github.com"
90+ Copy-Item CapsLockX\clx.exe clx-rust.exe
91+ Copy-Item CapsLockX\clx-screen-reader.exe clx-screen-reader.exe
7692 git add clx-rust.exe clx-screen-reader.exe
7793 git diff --cached --quiet || git commit -m "chore: update prebuilt binaries for ${{ github.ref_name }}"
7894 git push origin main
95+ shell : pwsh
7996
80- - name : Upload Windows binaries
97+ - name : Upload Windows package
8198 env :
8299 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
83- run : gh release upload "${{ github.ref_name }}" clx-rust.exe clx-screen-reader.exe --clobber
100+ run : gh release upload "${{ github.ref_name }}" CapsLockX-windows-x86_64.zip --clobber
84101
85102 build-linux :
86103 name : Build Linux (x86_64-unknown-linux-gnu)
@@ -109,13 +126,51 @@ jobs:
109126 working-directory : rs
110127 run : cargo build -p capslockx-linux --release
111128
112- - name : Stage Linux binary
113- run : cp rs/target/release/capslockx capslockx-linux-x86_64
114-
115- - name : Upload Linux binary
129+ - name : Package tar.gz
130+ run : |
131+ VERSION="${{ github.ref_name }}"
132+ STAGE="CapsLockX-${VERSION}-linux-x86_64"
133+ mkdir -p "$STAGE"
134+ cp rs/target/release/capslockx "$STAGE/clx"
135+ cp scripts/install.sh "$STAGE/install.sh"
136+ chmod +x "$STAGE/clx" "$STAGE/install.sh"
137+ tar czf "CapsLockX-linux-x86_64.tar.gz" "$STAGE"
138+
139+ - name : Package .deb
140+ run : |
141+ VERSION="${{ github.ref_name }}"
142+ # Strip leading 'v' and any pre-release suffix for deb version
143+ DEB_VERSION="${VERSION#v}"
144+ PKG="capslockx_${DEB_VERSION}_amd64"
145+ mkdir -p "$PKG/DEBIAN"
146+ mkdir -p "$PKG/usr/local/bin"
147+ cp rs/target/release/capslockx "$PKG/usr/local/bin/clx"
148+ chmod 755 "$PKG/usr/local/bin/clx"
149+ cat > "$PKG/DEBIAN/control" <<EOF
150+ Package: capslockx
151+ Version: ${DEB_VERSION}
152+ Section: utils
153+ Priority: optional
154+ Architecture: amd64
155+ Maintainer: snomiao <snomiao@gmail.com>
156+ Description: CapsLockX — keyboard productivity tool + LLM agent
157+ Uses CapsLock and Space as trigger keys for hotkey combos.
158+ Vim-style cursor, mouse control, window management, voice input, and AI agent.
159+ Homepage: https://github.com/snolab/CapsLockX
160+ EOF
161+ # Remove leading spaces from control file (heredoc indentation)
162+ sed -i 's/^ //' "$PKG/DEBIAN/control"
163+ dpkg-deb --build --root-owner-group "$PKG"
164+ mv "${PKG}.deb" "CapsLockX-linux-x86_64.deb"
165+
166+ - name : Upload Linux packages
116167 env :
117168 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
118- run : gh release upload "${{ github.ref_name }}" capslockx-linux-x86_64 --clobber
169+ run : |
170+ gh release upload "${{ github.ref_name }}" \
171+ CapsLockX-linux-x86_64.tar.gz \
172+ CapsLockX-linux-x86_64.deb \
173+ --clobber
119174
120175 build-macos :
121176 name : Build macOS (aarch64-apple-darwin)
@@ -141,8 +196,18 @@ jobs:
141196 working-directory : rs
142197 run : cargo build -p capslockx-macos --release
143198
144- - name : Stage macOS binary
145- run : cp rs/target/release/capslockx capslockx-macos-arm64
199+ - name : Code sign binary
200+ run : codesign -s - --force --identifier "com.snomiao.capslockx" rs/target/release/capslockx
201+
202+ - name : Package tar.gz
203+ run : |
204+ VERSION="${{ github.ref_name }}"
205+ STAGE="CapsLockX-${VERSION}-macos-arm64"
206+ mkdir -p "$STAGE"
207+ cp rs/target/release/capslockx "$STAGE/clx"
208+ cp scripts/install.sh "$STAGE/install.sh"
209+ chmod +x "$STAGE/clx" "$STAGE/install.sh"
210+ tar czf "CapsLockX-macos-arm64.tar.gz" "$STAGE"
146211
147212 # Commit binary to main only for stable releases
148213 - name : Commit macOS binary to main
@@ -153,11 +218,15 @@ jobs:
153218 git config user.name "github-actions[bot]"
154219 git config user.email "github-actions[bot]@users.noreply.github.com"
155220 git pull origin main --rebase
221+ cp rs/target/release/capslockx capslockx-macos-arm64
156222 git add capslockx-macos-arm64
157223 git diff --cached --quiet || git commit -m "chore: update macOS binary for ${{ github.ref_name }}"
158224 git push origin main
159225
160- - name : Upload macOS binary
226+ - name : Upload macOS package
161227 env :
162228 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
163- run : gh release upload "${{ github.ref_name }}" capslockx-macos-arm64 --clobber
229+ run : |
230+ gh release upload "${{ github.ref_name }}" \
231+ CapsLockX-macos-arm64.tar.gz \
232+ --clobber
0 commit comments