feat: add Developer ID signing and Apple notarization to CI (v2.4.0) #2
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*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| build_script: windows/build.ps1 | |
| artifact: windows/dist/claudecode-notification.exe | |
| - os: macos-latest | |
| artifact: macos/dist/ClaudeCodeNotification.zip | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET 8 SDK | |
| if: runner.os == 'Windows' | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - name: Build (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: .\${{ matrix.build_script }} | |
| # ─── macOS:导入证书 + Developer ID 签名 + 公证 ─── | |
| - name: Import signing certificate | |
| if: runner.os == 'macOS' | |
| env: | |
| MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} | |
| MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} | |
| run: | | |
| echo "$MACOS_CERTIFICATE" | base64 --decode > /tmp/cert.p12 | |
| security create-keychain -p "" build.keychain | |
| security default-keychain -s build.keychain | |
| security unlock-keychain -p "" build.keychain | |
| security import /tmp/cert.p12 -k build.keychain \ | |
| -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign | |
| security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain | |
| rm /tmp/cert.p12 | |
| - name: Build and notarize (macOS) | |
| if: runner.os == 'macOS' | |
| env: | |
| NOTARIZE_APPLE_ID: ${{ secrets.NOTARIZE_APPLE_ID }} | |
| NOTARIZE_APPLE_ID_PASSWORD: ${{ secrets.NOTARIZE_APPLE_ID_PASSWORD }} | |
| NOTARIZE_TEAM_ID: ${{ secrets.NOTARIZE_TEAM_ID }} | |
| run: | | |
| SIGN_IDENTITY=$(security find-identity -v -p codesigning build.keychain \ | |
| | grep 'Developer ID Application' | head -1 \ | |
| | sed -E 's/.*"(Developer ID Application: [^"]+)".*/\1/') | |
| bash macos/build.sh --sign "$SIGN_IDENTITY" --notarize | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ matrix.artifact }} |