- 20 份 release-notes-v*.md 移入 docs/release-notes/(git mv 保留历史) - 新增 CHANGELOG.md:v0.7.1~v0.7.20 倒序浓缩汇总(日期取各文件原始添加提交) - publish-gitea.sh 与 release.yml 改为 docs/release-notes/<tag>.md 优先、根目录回退
134 lines
3.9 KiB
YAML
134 lines
3.9 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
version-check:
|
|
name: Version consistency
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
- name: Verify tag matches package.json / Cargo.toml / tauri.conf.json
|
|
run: |
|
|
TAG="${GITHUB_REF_NAME}"
|
|
chmod +x scripts/check-version.sh
|
|
./scripts/check-version.sh "$TAG"
|
|
|
|
build:
|
|
name: Build (${{ matrix.platform }})
|
|
needs: version-check
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: ubuntu-latest
|
|
args: --bundles deb,appimage,rpm
|
|
- platform: macos-latest
|
|
args: --bundles app,dmg
|
|
- platform: windows-latest
|
|
args: --bundles msi
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
|
|
- name: Install npm dependencies
|
|
run: npm ci
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
cache: true
|
|
|
|
- name: Install Linux build dependencies
|
|
if: matrix.platform == 'ubuntu-latest'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libwebkit2gtk-4.1-dev \
|
|
librsvg2-dev \
|
|
patchelf \
|
|
build-essential \
|
|
curl \
|
|
wget \
|
|
file \
|
|
libssl-dev \
|
|
libgtk-3-dev \
|
|
libayatana-appindicator3-dev
|
|
|
|
- name: Compose release body
|
|
id: notes
|
|
shell: bash
|
|
run: |
|
|
FILE="docs/release-notes/${{ github.ref_name }}.md"
|
|
[ -f "$FILE" ] || FILE="release-notes-${{ github.ref_name }}.md"
|
|
{
|
|
echo 'body<<RELEASE_BODY_EOF'
|
|
if [ -f "$FILE" ]; then
|
|
cat "$FILE"
|
|
else
|
|
echo "## ${{ github.ref_name }}"
|
|
echo
|
|
echo "见提交记录(未找到 $FILE)。"
|
|
fi
|
|
echo
|
|
cat <<'TAIL_EOF'
|
|
### Downloads by platform
|
|
|
|
- **Windows**: `.msi` installer
|
|
- **macOS**: `.dmg` + `.app`(未签名,仅 Apple Silicon / M 系列芯片)
|
|
- **Linux**: `.deb` / `.AppImage` / `.rpm`
|
|
|
|
### macOS 安装说明(无开发者账号签名,需一次手动绕过)
|
|
|
|
1. 下载 `Kimi.Switch_*.dmg`,双击挂载后把 `Kimi Switch.app` 拖入「应用程序」文件夹
|
|
2. 下载本 Release 附带的 `install-macos.sh`,在终端运行:
|
|
|
|
```bash
|
|
bash install-macos.sh
|
|
```
|
|
|
|
脚本会自动清除「下载隔离」属性并启动应用,之后可正常使用。
|
|
3. 手动替代方案:右键 `Kimi Switch.app` → 打开 → 弹窗中点「打开」(或 系统设置 → 隐私与安全性 → 仍要打开)
|
|
|
|
Full changelog: see commit history.
|
|
TAIL_EOF
|
|
echo 'RELEASE_BODY_EOF'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build and upload release
|
|
uses: tauri-apps/tauri-action@v0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tagName: ${{ github.ref_name }}
|
|
releaseName: ${{ github.ref_name }}
|
|
releaseBody: ${{ steps.notes.outputs.body }}
|
|
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') }}
|
|
overwrite: true
|
|
args: ${{ matrix.args }}
|
|
|
|
upload-macos-script:
|
|
name: Attach macOS install script
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Upload install-macos.sh to release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: gh release upload "${{ github.ref_name }}" scripts/install-macos.sh --clobber
|