chore: bump version to v0.3.0 #14
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 | |
| on: | |
| push: | |
| branches: [main, preview] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build-mac-arm64: | |
| runs-on: macos-latest # GitHub Actions 默认 Apple Silicon | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: | | |
| npm ci --ignore-scripts | |
| npx electron-rebuild -f -w better-sqlite3 | |
| - name: Build & package (macOS ARM64) | |
| run: npm run dist:mac | |
| env: | |
| # ad-hoc 签名:无证书也可构建,产物仅限本地使用 | |
| CSC_IDENTITY_AUTO_DISCOVERY: false | |
| - name: Upload DMG | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PS2Code-mac-arm64 | |
| path: dist/PS2Code-*.dmg | |
| if-no-files-found: error | |
| build-win-x64: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: | | |
| npm ci --ignore-scripts | |
| npx electron-rebuild -f -w better-sqlite3 | |
| - name: Build & package (Windows x64) | |
| run: npm run dist:win | |
| - name: Upload NSIS installer | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PS2Code-win-x64 | |
| path: dist/PS2Code-*-x64.exe | |
| if-no-files-found: error | |
| # 汇总:展示 mac + win 产物下载链接 | |
| summarize: | |
| needs: [build-mac-arm64, build-win-x64] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { data } = await github.rest.actions.listWorkflowRunArtifacts({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| run_id: context.runId, | |
| }); | |
| let summary = '## ✅ 构建完成\n\n'; | |
| for (const art of data.artifacts) { | |
| const url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts/${art.id}`; | |
| summary += `- **${art.name}** (<code>${art.sizeInBytes > 1048576 ? (art.sizeInBytes / 1048576).toFixed(1) + ' MB' : (art.sizeInBytes / 1024).toFixed(1) + ' KB'}</code>) — Artifact download URL: ${url}\n`; | |
| } | |
| core.summary = summary; | |
| await core.summary.write(); | |
| console.log(summary); |