|
| 1 | +name: Build and Sign MSI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + workflow_dispatch: # 允许手动触发 |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: windows-latest |
| 12 | + permissions: |
| 13 | + contents: write |
| 14 | + id-token: write |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + submodules: recursive |
| 20 | + |
| 21 | + - name: Install Rust |
| 22 | + uses: dtolnay/rust-toolchain@stable |
| 23 | + with: |
| 24 | + targets: x86_64-pc-windows-msvc |
| 25 | + |
| 26 | + - name: Cache Cargo |
| 27 | + uses: actions/cache@v3 |
| 28 | + with: |
| 29 | + path: | |
| 30 | + ~/.cargo/bin/ |
| 31 | + ~/.cargo/registry/index/ |
| 32 | + ~/.cargo/registry/cache/ |
| 33 | + ~/.cargo/git/db/ |
| 34 | + target/ |
| 35 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 36 | + |
| 37 | + - name: Install WiX Toolset |
| 38 | + run: | |
| 39 | + dotnet tool install --global wix --version 4.0.1 |
| 40 | + # Note: If your build_msi.ps1 uses WiX v3, we might need to adjust it or install v3 here. |
| 41 | + # For v3, the runner usually has it pre-installed. |
| 42 | +
|
| 43 | + - name: Build Project |
| 44 | + run: ./build_release.ps1 |
| 45 | + |
| 46 | + - name: Build MSI |
| 47 | + run: ./build_msi.ps1 |
| 48 | + |
| 49 | + # --- 签名步骤 (在 Azure 拿到权限后取消注释) --- |
| 50 | + # - name: Sign MSI with Trusted Signing |
| 51 | + # uses: azure/trusted-signing-action@v0.3.1 |
| 52 | + # with: |
| 53 | + # endpoint: https://xxx.trustedsigning.azure.net/ # 替换为你的 Endpoint |
| 54 | + # trusted-signing-account-name: your-account-name # 替换为你的 Account Name |
| 55 | + # certificate-profile-name: your-profile-name # 替换为你的 Profile Name |
| 56 | + # files-folder: ${{ github.workspace }} |
| 57 | + # files-folder-filter: msi |
| 58 | + # files-folder-depth: 1 |
| 59 | + |
| 60 | + - name: Create Release and Upload MSI |
| 61 | + uses: softprops/action-gh-release@v1 |
| 62 | + with: |
| 63 | + files: SpaceThumbnails_Setup.msi |
| 64 | + env: |
| 65 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments