🚀 feat(.github/workflows):添加跨平台CI/CD构建工作流

📝 docs(README.md):更新构建说明,移除Stack支持
♻️ refactor(app/):清理Config.hs和Main.hs中的未使用导入
This commit is contained in:
2026-02-04 16:13:25 +08:00
parent eb48924491
commit 40387909d3
4 changed files with 102 additions and 16 deletions

99
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,99 @@
name: Cross Platform Build
on:
push:
tags:
- 'v*'
jobs:
build:
name: ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Linux x86_64
- os: ubuntu-latest
arch: x86_64
ext: ""
# macOS Apple Silicon
- os: macos-latest
arch: arm64
ext: ""
# Windows
- os: windows-latest
arch: x86_64
ext: ".exe"
steps:
- uses: actions/checkout@v4
# 安装 GHC 和 Cabal
- name: Setup Haskell
uses: haskell-actions/setup@v2
with:
ghc-version: '9.6.7'
cabal-version: '3.12'
# 缓存依赖加速构建
- name: Cache Cabal
uses: actions/cache@v4
with:
path: |
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('**/*.cabal') }}
# 配置静态链接Linux
- name: Configure Static Build (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
echo "GHC_MUSL=1" >> $GITHUB_ENV
# 构建
- name: Build
run: |
cabal update
cabal build --enable-executable-stripping --disable-debug-info -j2
# 提取可执行文件路径
- name: Find Executable
id: exe
shell: bash
run: |
EXE_PATH=$(cabal list-bin quickjump)
echo "path=$EXE_PATH" >> $GITHUB_OUTPUT
# 重命名为标准格式
- name: Rename Artifact
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/}
cp "${{ steps.exe.outputs.path }}" ./quickjump-${VERSION}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
# 上传产物
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: quickjump-${{ matrix.os }}-${{ matrix.arch }}
path: quickjump-*-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
# 创建 Release
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: ./artifacts
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: ./artifacts/*
generate_release_notes: true

View File

@@ -22,17 +22,12 @@
### 使用 Cabal ### 使用 Cabal
```bash ```bash
git clone https://git.lyz.one/sidneyzhang/quickjump.git
cd quickjump
cabal build cabal build
cabal install cabal install
``` ```
### 使用 Stack
```bash
stack build
stack install
```
## 配置 Shell 集成 ## 配置 Shell 集成
### Linux/macOS (Bash/Zsh) ### Linux/macOS (Bash/Zsh)

View File

@@ -14,16 +14,11 @@ module Config
) where ) where
import Control.Exception (catch, throwIO) import Control.Exception (catch, throwIO)
import Control.Monad (unless, when) import Data.Aeson (eitherDecode)
import Data.Aeson (eitherDecode, encode)
import Data.Aeson.Encode.Pretty (encodePretty) import Data.Aeson.Encode.Pretty (encodePretty)
import Data.Bifunctor (first)
import Data.List (sortOn) import Data.List (sortOn)
import Data.Map (Map)
import qualified Data.Map as M import qualified Data.Map as M
import Data.Maybe (fromMaybe)
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy as BL
import System.Directory (createDirectoryIfMissing, doesFileExist, import System.Directory (createDirectoryIfMissing, doesFileExist,
getHomeDirectory) getHomeDirectory)

View File

@@ -2,11 +2,8 @@
module Main where module Main where
-- import Data.Text (Text)
-- import qualified Data.Text as T
import Options.Applicative import Options.Applicative
import System.Environment (getArgs, withArgs) import System.Environment (getArgs, withArgs)
-- import System.IO (hPutStrLn, stderr)
import Commands import Commands
import Types import Types