chore: v1.0.7 #54
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # 当推送以 v 开头的标签时触发,如 v1.0.0 | |
| - 'Beta*' # 当推送以 Beta 开头的标签时触发,如 Beta-v1.0.0 | |
| jobs: | |
| release: | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| include: | |
| # macOS 构建 (支持 arm64 和 x64) | |
| - os: macos-latest | |
| platform: mac | |
| arch: x64 | |
| script: dist:mac-x64 | |
| - os: macos-latest | |
| platform: mac | |
| arch: arm64 | |
| script: dist:mac-arm64 | |
| # Windows 构建 (x64) | |
| - os: windows-latest | |
| platform: win | |
| arch: x64 | |
| script: dist:win-x64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.13.1 | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| # - name: Setup pnpm cache | |
| # uses: actions/cache@v3 | |
| # with: | |
| # path: ${{ env.STORE_PATH }} | |
| # key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| # restore-keys: | | |
| # ${{ runner.os }}-pnpm-store- | |
| - name: Configure Git for HTTPS | |
| run: git config --global url."https://github.com/".insteadOf "git@github.com:" | |
| - name: Install dependencies | |
| run: | | |
| pnpm install --no-frozen-lockfile | |
| pnpm rebuild | |
| - name: Remove China mirror for CI | |
| shell: bash | |
| run: sed -i'.bak' '/electron_mirror/d' .npmrc | |
| - name: Build application | |
| run: pnpm run ${{ matrix.script }} -- --publish never | |
| - name: Compress win-unpacked to zip | |
| if: matrix.platform == 'win' | |
| shell: pwsh | |
| run: Compress-Archive -Path "dist/win-unpacked/*" -DestinationPath "dist/milkup-win-x64-unpacked.zip" | |
| - name: Upload artifacts (macOS x64) | |
| if: matrix.platform == 'mac' && matrix.arch == 'x64' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: milkup-${{ matrix.platform }}-${{ matrix.arch }} | |
| path: | | |
| dist/milkup-*.dmg | |
| dist/milkup-*.dmg.blockmap | |
| dist/latest-mac.yml | |
| retention-days: 5 | |
| - name: Upload artifacts (macOS arm64) | |
| if: matrix.platform == 'mac' && matrix.arch == 'arm64' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: milkup-${{ matrix.platform }}-${{ matrix.arch }} | |
| path: | | |
| dist/milkup-*-arm64.dmg | |
| dist/milkup-*-arm64.dmg.blockmap | |
| dist/latest-mac.yml | |
| retention-days: 5 | |
| - name: Upload artifacts (Windows) | |
| if: matrix.platform == 'win' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: milkup-${{ matrix.platform }}-${{ matrix.arch }} | |
| path: | | |
| dist/milkup Setup *.exe | |
| dist/milkup Setup *.exe.blockmap | |
| dist/milkup-win-x64-unpacked.zip | |
| dist/latest.yml | |
| retention-days: 5 | |
| # 创建 GitHub Release 并上传所有构建产物 | |
| create-release: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.13.1 | |
| - name: Install Dependencies | |
| run: pnpm install | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: | | |
| echo "=== Artifacts structure ===" | |
| find artifacts -type f | sort | |
| echo "=== DMG files ===" | |
| find artifacts -name "*.dmg" | sort | |
| echo "=== EXE files ===" | |
| find artifacts -name "*.exe" | sort | |
| - name: Prepare release files | |
| run: | | |
| mkdir -p release_files | |
| # Copy unique files to avoid duplicates | |
| find artifacts -name "*.dmg" -exec cp {} release_files/ \; | |
| find artifacts -name "*.exe" -exec cp {} release_files/ \; | |
| find artifacts -name "*.zip" -exec cp {} release_files/ \; | |
| echo "=== Release files ===" | |
| ls -la release_files/ | |
| - name: Create Release | |
| run: pnpm run release -- --assets "release_files/*" | |
| env: | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| # - name: Create Release | |
| # uses: softprops/action-gh-release@v1 | |
| # with: | |
| # tag_name: ${{ github.ref_name }} | |
| # name: milkup ${{ github.ref_name }} | |
| # draft: false | |
| # prerelease: false | |
| # body: | | |
| # ## milkup ${{ github.ref_name }} | |
| # | |
| # ### 下载说明 | |
| # - **macOS Intel**: 下载 DMG 文件(不含 arm64 后缀) | |
| # - **macOS Apple Silicon**: 下载带 arm64 后缀的 DMG 文件 | |
| # - **Windows x64**: 下载 EXE 安装文件 | |
| # | |
| # ### 更新内容 | |
| # 请查看 commit 历史了解详细更新内容。 | |
| # files: release_files/* | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |