|
| 1 | +name: Desktop Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: Release tag to publish, for example v0.1.0 |
| 11 | + required: true |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + |
| 16 | +env: |
| 17 | + NODE_VERSION: 22.17.1 |
| 18 | + |
| 19 | +jobs: |
| 20 | + macos: |
| 21 | + name: macOS ${{ matrix.name }} |
| 22 | + runs-on: ${{ matrix.runner }} |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - name: Intel |
| 28 | + runner: macos-13 |
| 29 | + target: x86_64-apple-darwin |
| 30 | + suffix: x64 |
| 31 | + - name: Apple Silicon |
| 32 | + runner: macos-14 |
| 33 | + target: aarch64-apple-darwin |
| 34 | + suffix: aarch64 |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + ref: ${{ github.event.inputs.tag || github.ref }} |
| 39 | + |
| 40 | + - uses: actions/setup-node@v4 |
| 41 | + with: |
| 42 | + node-version: ${{ env.NODE_VERSION }} |
| 43 | + |
| 44 | + - name: Install pnpm |
| 45 | + run: npm install -g pnpm@10.32.1 |
| 46 | + |
| 47 | + - uses: dtolnay/rust-toolchain@stable |
| 48 | + with: |
| 49 | + targets: ${{ matrix.target }} |
| 50 | + |
| 51 | + - name: Install protobuf compiler |
| 52 | + run: brew install protobuf |
| 53 | + |
| 54 | + - uses: Swatinem/rust-cache@v2 |
| 55 | + with: |
| 56 | + workspaces: crates/agent-gui/src-tauri |
| 57 | + |
| 58 | + - name: Install frontend dependencies |
| 59 | + working-directory: crates/agent-gui |
| 60 | + run: pnpm install --frozen-lockfile |
| 61 | + |
| 62 | + - name: Import Apple signing certificate |
| 63 | + env: |
| 64 | + APPLE_CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_CERTIFICATE_P12_BASE64 }} |
| 65 | + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} |
| 66 | + run: | |
| 67 | + set -euo pipefail |
| 68 | + test -n "$APPLE_CERTIFICATE_P12_BASE64" |
| 69 | + test -n "$APPLE_CERTIFICATE_PASSWORD" |
| 70 | + KEYCHAIN_PATH="$RUNNER_TEMP/liveagent-release.keychain-db" |
| 71 | + KEYCHAIN_PASSWORD="$(openssl rand -hex 24)" |
| 72 | + CERT_PATH="$RUNNER_TEMP/developer-id-application.p12" |
| 73 | + printf '%s' "$APPLE_CERTIFICATE_P12_BASE64" | base64 --decode > "$CERT_PATH" |
| 74 | + security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" |
| 75 | + security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH" |
| 76 | + security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" |
| 77 | + security import "$CERT_PATH" -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" |
| 78 | + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" |
| 79 | + security list-keychains -d user -s "$KEYCHAIN_PATH" |
| 80 | + security default-keychain -s "$KEYCHAIN_PATH" |
| 81 | + security find-identity -v -p codesigning "$KEYCHAIN_PATH" |
| 82 | +
|
| 83 | + - name: Store notarization profile |
| 84 | + env: |
| 85 | + APPLE_ID: ${{ secrets.APPLE_ID }} |
| 86 | + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} |
| 87 | + APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} |
| 88 | + run: | |
| 89 | + set -euo pipefail |
| 90 | + test -n "$APPLE_ID" |
| 91 | + test -n "$APPLE_TEAM_ID" |
| 92 | + test -n "$APPLE_APP_SPECIFIC_PASSWORD" |
| 93 | + xcrun notarytool store-credentials liveagent-notary \ |
| 94 | + --apple-id "$APPLE_ID" \ |
| 95 | + --team-id "$APPLE_TEAM_ID" \ |
| 96 | + --password "$APPLE_APP_SPECIFIC_PASSWORD" \ |
| 97 | + --validate |
| 98 | +
|
| 99 | + - name: Build signed and notarized DMG |
| 100 | + env: |
| 101 | + APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} |
| 102 | + DESKTOP_MACOS_TARGET: ${{ matrix.target }} |
| 103 | + run: make desktop-build-macos-release |
| 104 | + |
| 105 | + - name: Stage macOS artifact |
| 106 | + env: |
| 107 | + RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }} |
| 108 | + run: | |
| 109 | + set -euo pipefail |
| 110 | + mkdir -p dist |
| 111 | + dmg_path="$(find "target/${{ matrix.target }}/release/bundle/dmg" -maxdepth 1 -name 'LiveAgent_*.dmg' -print -quit)" |
| 112 | + test -n "$dmg_path" |
| 113 | + cp "$dmg_path" "dist/LiveAgent_${RELEASE_TAG}_${{ matrix.suffix }}.dmg" |
| 114 | +
|
| 115 | + - uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: liveagent-macos-${{ matrix.suffix }} |
| 118 | + path: dist/*.dmg |
| 119 | + if-no-files-found: error |
| 120 | + |
| 121 | + windows: |
| 122 | + name: Windows x64 |
| 123 | + runs-on: windows-latest |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@v4 |
| 126 | + with: |
| 127 | + ref: ${{ github.event.inputs.tag || github.ref }} |
| 128 | + |
| 129 | + - uses: actions/setup-node@v4 |
| 130 | + with: |
| 131 | + node-version: ${{ env.NODE_VERSION }} |
| 132 | + |
| 133 | + - name: Install pnpm |
| 134 | + run: npm install -g pnpm@10.32.1 |
| 135 | + |
| 136 | + - uses: dtolnay/rust-toolchain@stable |
| 137 | + |
| 138 | + - name: Install protobuf compiler |
| 139 | + run: | |
| 140 | + choco install protoc -y --no-progress |
| 141 | + "$env:ChocolateyInstall\lib\protoc\tools\bin" | Out-File -Append $env:GITHUB_PATH |
| 142 | +
|
| 143 | + - uses: Swatinem/rust-cache@v2 |
| 144 | + with: |
| 145 | + workspaces: crates/agent-gui/src-tauri |
| 146 | + |
| 147 | + - name: Install frontend dependencies |
| 148 | + working-directory: crates/agent-gui |
| 149 | + run: pnpm install --frozen-lockfile |
| 150 | + |
| 151 | + - name: Build Windows bundles |
| 152 | + working-directory: crates/agent-gui |
| 153 | + run: pnpm tauri build --config src-tauri/tauri.windows.conf.json --target x86_64-pc-windows-msvc |
| 154 | + |
| 155 | + - name: Stage Windows artifacts |
| 156 | + shell: bash |
| 157 | + run: | |
| 158 | + set -euo pipefail |
| 159 | + mkdir -p dist |
| 160 | + find target crates/agent-gui/src-tauri/target -type f \( -name '*.msi' -o -name '*.exe' \) -path '*bundle*' -exec cp {} dist/ \; 2>/dev/null || true |
| 161 | + test "$(find dist -type f | wc -l)" -gt 0 |
| 162 | +
|
| 163 | + - uses: actions/upload-artifact@v4 |
| 164 | + with: |
| 165 | + name: liveagent-windows-x64 |
| 166 | + path: dist/* |
| 167 | + if-no-files-found: error |
| 168 | + |
| 169 | + publish: |
| 170 | + name: Publish GitHub Release |
| 171 | + runs-on: ubuntu-latest |
| 172 | + needs: |
| 173 | + - macos |
| 174 | + - windows |
| 175 | + steps: |
| 176 | + - uses: actions/download-artifact@v4 |
| 177 | + with: |
| 178 | + path: release-artifacts |
| 179 | + merge-multiple: true |
| 180 | + |
| 181 | + - name: Publish assets |
| 182 | + env: |
| 183 | + GH_TOKEN: ${{ github.token }} |
| 184 | + RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }} |
| 185 | + run: | |
| 186 | + set -euo pipefail |
| 187 | + gh release view "$RELEASE_TAG" >/dev/null 2>&1 || \ |
| 188 | + gh release create "$RELEASE_TAG" --title "$RELEASE_TAG" --notes "Automated LiveAgent release." |
| 189 | + gh release upload "$RELEASE_TAG" release-artifacts/* --clobber |
0 commit comments