|
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | build: |
11 | | - permissions: |
12 | | - contents: write |
13 | | - actions: read |
14 | | - |
15 | 11 | strategy: |
16 | 12 | fail-fast: false |
17 | 13 | matrix: |
18 | 14 | include: |
19 | | - - os: macos-latest |
| 15 | + - name: macOS (Apple Silicon) |
| 16 | + os: macos-latest |
20 | 17 | target: aarch64-apple-darwin |
| 18 | + args: --bundles dmg |
| 19 | + artifact: subtitle-renamer_${{ github.ref_name }}_macos_aarch64.dmg |
21 | 20 |
|
22 | | - - os: macos-latest |
| 21 | + - name: macOS (Intel) |
| 22 | + os: macos-latest |
23 | 23 | target: x86_64-apple-darwin |
| 24 | + args: --bundles dmg |
| 25 | + artifact: subtitle-renamer_${{ github.ref_name }}_macos_x64.dmg |
24 | 26 |
|
25 | | - - os: windows-latest |
| 27 | + - name: Windows (x64) |
| 28 | + os: windows-latest |
26 | 29 | target: x86_64-pc-windows-msvc |
| 30 | + args: --no-bundle |
| 31 | + artifact: subtitle-renamer_${{ github.ref_name }}_windows_x64.zip |
| 32 | + exeName: Subtitle Renamer.exe |
27 | 33 |
|
| 34 | + name: Build (${{ matrix.name }}) |
28 | 35 | runs-on: ${{ matrix.os }} |
29 | 36 |
|
30 | 37 | steps: |
@@ -55,44 +62,59 @@ jobs: |
55 | 62 | - name: Install frontend dependencies |
56 | 63 | run: pnpm install |
57 | 64 |
|
58 | | - - name: Build and release |
59 | | - uses: tauri-apps/tauri-action@v0 |
| 65 | + - name: Build Tauri app |
| 66 | + run: pnpm tauri build --target ${{ matrix.target }} ${{ matrix.args }} |
60 | 67 | env: |
61 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
62 | | - with: |
63 | | - tagName: ${{ github.ref_name }} |
64 | | - releaseName: v${{ github.ref_name }} |
65 | | - releaseBody: | |
66 | | - ## 新增 |
67 | | - - 新增内容 |
68 | | - |
69 | | - ## 优化 |
70 | | - - 优化内容 |
| 68 | + CI: ${{ matrix.os == 'macos-latest' && 'false' || 'true' }} |
71 | 69 |
|
72 | | - ## 修复 |
73 | | - - 修复内容 |
74 | | - releaseDraft: true |
75 | | - assetNamePattern: >- |
76 | | - ${{ matrix.os == 'macos-latest' |
77 | | - && 'subtitle-renamer_[version]_macos_[arch][ext]' |
78 | | - || 'Subtitle Renamer' }} |
79 | | - args: >- |
80 | | - ${{ matrix.os == 'macos-latest' |
81 | | - && format('--target {0} --bundles dmg', matrix.target) |
82 | | - || format('--target {0} --no-bundle', matrix.target) }} |
83 | | - uploadPlainBinary: ${{ matrix.os == 'windows-latest' }} |
84 | | - |
85 | | - - name: Zip Windows exe |
| 70 | + - name: Prepare macOS artifact |
| 71 | + if: matrix.os == 'macos-latest' |
| 72 | + run: | |
| 73 | + DMG=$(find src/target/${{ matrix.target }}/release/bundle/dmg -name "*.dmg" | head -1) |
| 74 | + cp "$DMG" "${{ matrix.artifact }}" |
| 75 | +
|
| 76 | + - name: Prepare Windows artifact |
86 | 77 | if: matrix.os == 'windows-latest' |
87 | 78 | shell: powershell |
88 | 79 | run: | |
89 | 80 | $exe = Get-ChildItem src\target\${{ matrix.target }}\release\*.exe |
90 | | - Compress-Archive -Path $exe.FullName -DestinationPath subtitle-renamer_${{ github.ref_name }}_windows_x64.zip |
| 81 | + Copy-Item $exe.FullName "${{ matrix.exeName }}" |
| 82 | + Compress-Archive -Path "${{ matrix.exeName }}" -DestinationPath ${{ matrix.artifact }} |
91 | 83 |
|
92 | | - - name: Upload Windows zip |
93 | | - if: matrix.os == 'windows-latest' |
| 84 | + - name: Upload artifacts |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: ${{ matrix.target }} |
| 88 | + path: ${{ matrix.artifact }} |
| 89 | + |
| 90 | + release: |
| 91 | + name: Release |
| 92 | + needs: build |
| 93 | + runs-on: ubuntu-latest |
| 94 | + permissions: |
| 95 | + contents: write |
| 96 | + |
| 97 | + steps: |
| 98 | + - name: Download all artifacts |
| 99 | + uses: actions/download-artifact@v4 |
| 100 | + with: |
| 101 | + merge-multiple: true |
| 102 | + |
| 103 | + - name: Create release |
94 | 104 | uses: softprops/action-gh-release@v2 |
95 | 105 | with: |
96 | 106 | tag_name: ${{ github.ref_name }} |
| 107 | + name: 🎉 ${{ github.ref_name }} |
| 108 | + body: | |
| 109 | + ## 新增 |
| 110 | + - 新增内容 |
| 111 | + |
| 112 | + ## 优化 |
| 113 | + - 优化内容 |
| 114 | +
|
| 115 | + ## 修复 |
| 116 | + - 修复内容 |
97 | 117 | draft: true |
98 | | - files: subtitle-renamer_${{ github.ref_name }}_windows_x64.zip |
| 118 | + files: | |
| 119 | + *.dmg |
| 120 | + *.zip |
0 commit comments