feat: 新增未选阵容时阻止开始并提示 #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| # 当推送 tag 时触发(如 v1.0.0, v1.2.3) | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| # 1. 检出代码 | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # 2. 安装 Node.js | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| # 3. 安装依赖 | |
| - name: Install dependencies | |
| run: npm ci | |
| # 4. 打包 Electron 应用 | |
| - name: Build Electron app | |
| run: npm run dist:win | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # 5. 上传构建产物 | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-files | |
| path: | | |
| release/*.exe | |
| release/*.zip | |
| retention-days: 5 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract release notes | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "Extracting release notes for version $VERSION" | |
| awk "/^## \[$VERSION\]/{flag=1;next} /^## /{flag=0} flag" CHANGELOG.md > RELEASE_NOTE.md | |
| cat RELEASE_NOTE.md | |
| # 1. 下载构建产物 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release-files | |
| path: ./release | |
| # 2. 创建 Release 并上传文件 | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| release/*.exe | |
| release/*.zip | |
| body_path: RELEASE_NOTE.md | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |