|
55 | 55 | cat > "$RUNNER_TEMP/notes.md" <<'NOTES' |
56 | 56 | ## FigyTerm v__VERSION__ |
57 | 57 |
|
| 58 | + ### Updating |
| 59 | +
|
| 60 | + FigyTerm updates itself from here on — it checks for new versions and |
| 61 | + installs them in-app, with no Gatekeeper prompt and no `xattr` step. |
| 62 | + If you're coming from **v0.0.6 or earlier**, this one install is manual; |
| 63 | + after it, updates are automatic. |
| 64 | +
|
58 | 65 | ### Installation (macOS) |
59 | 66 |
|
60 | 67 | 1. Download `FigyTerm___VERSION___aarch64.dmg` (Apple Silicon) or `FigyTerm___VERSION___x64.dmg` (Intel) |
@@ -186,16 +193,108 @@ jobs: |
186 | 193 | uses: tauri-apps/tauri-action@v1 |
187 | 194 | env: |
188 | 195 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 196 | + # Minisign keypair for the updater. Unrelated to Apple code signing — |
| 197 | + # it only lets installed clients verify an update came from us. |
| 198 | + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} |
| 199 | + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} |
| 200 | + # Apple signing is optional and currently unset; tauri-action builds |
| 201 | + # unsigned when these are absent. Present so enabling notarization |
| 202 | + # later is a secret upload rather than a workflow change. |
| 203 | + APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} |
| 204 | + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} |
| 205 | + APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} |
| 206 | + APPLE_ID: ${{ secrets.APPLE_ID }} |
| 207 | + APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} |
| 208 | + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} |
189 | 209 | with: |
190 | 210 | releaseId: ${{ needs.create-release.outputs.release_id }} |
191 | 211 | args: ${{ matrix.args }} |
| 212 | + # The manifest is written by the updater-manifest job instead. With a |
| 213 | + # two-target matrix, letting both builds upload latest.json races: |
| 214 | + # whichever finishes last overwrites the other's entry, producing an |
| 215 | + # updater that silently 404s for one architecture. |
192 | 216 | uploadUpdaterJson: false |
193 | 217 |
|
194 | | - publish-release: |
| 218 | + # Composes latest.json once, after both architectures have uploaded their |
| 219 | + # updater artifacts, so it always describes both. |
| 220 | + updater-manifest: |
195 | 221 | needs: [create-release, build-macos] |
196 | 222 | permissions: |
197 | 223 | contents: write |
198 | 224 | runs-on: ubuntu-latest |
| 225 | + steps: |
| 226 | + - name: Compose and upload latest.json |
| 227 | + env: |
| 228 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 229 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 230 | + GH_REPO: ${{ github.repository }} |
| 231 | + TAG: ${{ needs.create-release.outputs.tag }} |
| 232 | + VERSION: ${{ needs.create-release.outputs.version }} |
| 233 | + RELEASE_ID: ${{ needs.create-release.outputs.release_id }} |
| 234 | + run: | |
| 235 | + set -euo pipefail |
| 236 | +
|
| 237 | + # The release is still a draft here, so it must be addressed by id. |
| 238 | + gh api --paginate "repos/$GH_REPO/releases/$RELEASE_ID/assets?per_page=100" \ |
| 239 | + > assets.json |
| 240 | +
|
| 241 | + PLATFORMS='{}' |
| 242 | +
|
| 243 | + for ARCH in aarch64 x64; do |
| 244 | + case "$ARCH" in |
| 245 | + aarch64) PLATFORM=darwin-aarch64 ;; |
| 246 | + x64) PLATFORM=darwin-x86_64 ;; |
| 247 | + esac |
| 248 | +
|
| 249 | + TARBALL="FigyTerm_${VERSION}_${ARCH}.app.tar.gz" |
| 250 | + SIG_ID=$(jq -r --arg n "${TARBALL}.sig" \ |
| 251 | + '.[] | select(.name == $n) | .id' assets.json | head -n1) |
| 252 | +
|
| 253 | + if [ -z "$SIG_ID" ]; then |
| 254 | + echo "::error::${TARBALL}.sig is missing from the release. Is TAURI_SIGNING_PRIVATE_KEY set?" |
| 255 | + exit 1 |
| 256 | + fi |
| 257 | +
|
| 258 | + SIG=$(gh api -H "Accept: application/octet-stream" \ |
| 259 | + "repos/$GH_REPO/releases/assets/$SIG_ID") |
| 260 | +
|
| 261 | + # Public download URL, valid once the release is undrafted. |
| 262 | + URL="https://github.com/$GH_REPO/releases/download/$TAG/$TARBALL" |
| 263 | +
|
| 264 | + PLATFORMS=$(jq \ |
| 265 | + --arg k "$PLATFORM" --arg s "$SIG" --arg u "$URL" \ |
| 266 | + '. + {($k): {signature: $s, url: $u}}' <<<"$PLATFORMS") |
| 267 | + done |
| 268 | +
|
| 269 | + jq -n \ |
| 270 | + --arg v "$VERSION" \ |
| 271 | + --arg d "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ |
| 272 | + --argjson p "$PLATFORMS" \ |
| 273 | + '{version: $v, notes: "See the release notes on GitHub.", pub_date: $d, platforms: $p}' \ |
| 274 | + > latest.json |
| 275 | +
|
| 276 | + cat latest.json |
| 277 | +
|
| 278 | + # Re-runs: drop the previous manifest so the upload doesn't collide. |
| 279 | + OLD_ID=$(jq -r '.[] | select(.name == "latest.json") | .id' assets.json | head -n1) |
| 280 | + if [ -n "$OLD_ID" ]; then |
| 281 | + gh api --method DELETE "repos/$GH_REPO/releases/assets/$OLD_ID" >/dev/null |
| 282 | + fi |
| 283 | +
|
| 284 | + curl -sSf -X POST \ |
| 285 | + -H "Authorization: Bearer $GITHUB_TOKEN" \ |
| 286 | + -H "Content-Type: application/json" \ |
| 287 | + --data-binary @latest.json \ |
| 288 | + "https://uploads.github.com/repos/$GH_REPO/releases/$RELEASE_ID/assets?name=latest.json" \ |
| 289 | + >/dev/null |
| 290 | +
|
| 291 | + echo "Uploaded latest.json for $TAG" |
| 292 | +
|
| 293 | + publish-release: |
| 294 | + needs: [create-release, build-macos, updater-manifest] |
| 295 | + permissions: |
| 296 | + contents: write |
| 297 | + runs-on: ubuntu-latest |
199 | 298 | steps: |
200 | 299 | - name: Undraft release |
201 | 300 | env: |
|
0 commit comments