| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- name: Release
- on:
- push:
- tags:
- - 'v*'
- jobs:
- release:
- strategy:
- fail-fast: false
- matrix:
- include:
- - os: windows-latest
- platform: win
- - os: macos-latest
- platform: mac
- - os: ubuntu-latest
- platform: linux
- runs-on: ${{ matrix.os }}
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
- - name: Extract version from tag
- id: version
- shell: bash
- run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- - name: Update package.json version
- shell: bash
- run: |
- npm pkg set version=${{ steps.version.outputs.VERSION }}
- - name: Install dependencies
- run: npm ci
- - name: Type check
- run: npm run typecheck
- - name: Build frontend
- run: npx vite build
- - name: Package application
- run: npx electron-builder --${{ matrix.platform }}
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Build portable version with launcher (Windows only)
- if: matrix.platform == 'win'
- shell: pwsh
- run: |
- # Build launcher
- npx pkg launcher/launcher.js --target node18-win-x64 --output release/launcher.exe
- # Find portable exe
- $portableExe = Get-ChildItem -Path release -Filter "*portable*.exe" | Select-Object -First 1
- if (-not $portableExe) {
- Write-Error "Portable exe not found"
- exit 1
- }
- $version = "${{ steps.version.outputs.VERSION }}"
- $portableDirName = "Claude-AI-Installer-$version-portable"
- $portableDir = "release/$portableDirName"
- # Create directory structure
- New-Item -ItemType Directory -Force -Path "$portableDir/app"
- New-Item -ItemType Directory -Force -Path "$portableDir/update"
- # Copy files
- Copy-Item "release/launcher.exe" "$portableDir/Claude-AI-Installer.exe"
- Copy-Item $portableExe.FullName "$portableDir/app/Claude-AI-Installer-$version.exe"
- # Create README
- @"
- Claude AI Installer - Portable 版本
- 使用方法:
- 1. 双击 Claude-AI-Installer.exe 启动程序
- 2. 程序会自动检查更新
- 3. 更新下载后,重启程序即可完成更新
- 目录说明:
- - Claude-AI-Installer.exe: 启动器
- - app/: 主程序目录
- - update/: 更新文件临时目录
- 版本: $version
- "@ | Out-File -FilePath "$portableDir/README.txt" -Encoding UTF8
- # Create ZIP
- Compress-Archive -Path "$portableDir/*" -DestinationPath "release/$portableDirName.zip" -Force
- - name: Upload release assets
- uses: softprops/action-gh-release@v2
- with:
- files: |
- release/*.exe
- release/*.dmg
- release/*.zip
- release/*.AppImage
- release/*.deb
- release/*.rpm
- release/*.yml
- release/*.yaml
- draft: false
- prerelease: false
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|