Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

Add fastlane scaffolding for macOS code signing (#3507)

Gio Lodi0300d85e3870
diff --git a/.buildkite/commands/build-desktop.sh b/.buildkite/commands/build-desktop.sh
new file mode 100755
index 000000000..4f43e8424
--- /dev/null
+++ b/.buildkite/commands/build-desktop.sh
@@ -0,0 +1,119 @@
+#!/usr/bin/env bash
+# Buildkite step: build, sign, and notarize harper-desktop.
+# See .buildkite/pipeline.yml.
+
+set -euo pipefail
+
+echo "--- :rubygems: Install gems"
+install_gems
+
+echo "--- :rust: Install Rust toolchain"
+# A8C Mac VMs have no Rust tooling baked in. Install `rustup` non-interactively,
+# then add the targets we need.
+# `--no-modify-path` is intentional: we source `cargo/env` ourselves below so
+# nothing outside this build step picks up cargo on a shared agent.
+if ! command -v rustup >/dev/null 2>&1; then
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
+ | sh -s -- -y --no-modify-path --default-toolchain stable --profile minimal
+fi
+# shellcheck disable=SC1091
+. "$HOME/.cargo/env"
+
+# Universal builds (master, tags) need both arches. PR/branch builds run
+# Apple-Silicon-only to skip the x86_64 half of the compile (~4m saved).
+if [ "${BUILDKITE_BRANCH:-}" = "master" ] || [ -n "${BUILDKITE_TAG:-}" ]; then
+ TAURI_TARGET=universal-apple-darwin
+ JUST_RECIPE=build-desktop-macos
+ rustup target add aarch64-apple-darwin x86_64-apple-darwin wasm32-unknown-unknown
+else
+ TAURI_TARGET=aarch64-apple-darwin
+ JUST_RECIPE=build-desktop-macos-arm64
+ rustup target add aarch64-apple-darwin wasm32-unknown-unknown
+fi
+echo "Build target: $TAURI_TARGET (recipe: $JUST_RECIPE)"
+
+echo "--- :floppy_disk: Restore cargo caches"
+# Two cache layers, both keyed off Cargo.lock + rust-toolchain.toml so they
+# invalidate the moment any dep version moves.
+# 1. `~/.cargo/registry` + `~/.cargo/git/db` — downloaded crate sources / git
+# deps. ~340MB compressed. Saves the crate-download phase on cold builds.
+# 2. `target/` — compiled artifacts. Several GB compressed. Lets cargo's
+# incremental compilation reuse object files across builds. The target
+# cache also includes the Tauri target arch in its key, since universal
+# and arm64-only builds produce disjoint object trees.
+CARGO_DEPS_KEY="$BUILDKITE_PIPELINE_SLUG-cargo-deps-darwin-arm64-$(hash_file Cargo.lock)-$(hash_file rust-toolchain.toml)"
+CARGO_TARGET_KEY="$BUILDKITE_PIPELINE_SLUG-target-darwin-arm64-$TAURI_TARGET-$(hash_file Cargo.lock)-$(hash_file rust-toolchain.toml)"
+restore_cache "$CARGO_DEPS_KEY"
+restore_cache "$CARGO_TARGET_KEY"
+
+echo "--- :package: Install build tools"
+# Without Rust pre-baked there's no `cargo-binstall` either. Use cargo-binstall's
+# own curl installer to pull a prebuilt — about a second, vs ~1m15s of `cargo
+# install --locked` building it from source.
+if ! command -v cargo-binstall >/dev/null 2>&1; then
+ curl -L --proto '=https' --tlsv1.2 -sSf \
+ https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh \
+ | bash
+fi
+cargo binstall --no-confirm --force just
+cargo binstall --no-confirm --force wasm-pack
+# Skip cargo-binstall'ing `tauri-cli` — Tauri doesn't publish GitHub release
+# prebuilts for the CLI, so binstall always falls back to a source compile
+# (~2 minutes). `@tauri-apps/cli` from npm is the same Rust binary distributed
+# via platform-specific subpackages — it's already a devDependency of
+# `harper-desktop/package.json`, so `pnpm install` in that directory will pick
+# it up. The justfile recipes invoke it as `pnpm tauri build` rather than
+# `cargo tauri build`.
+
+echo "--- :npm: Install pnpm"
+# Node is set up by the `automattic/nvm` Buildkite plugin from `.nvmrc`.
+# `pnpm` is not bundled — install it via `npm install -g`. Pin matches the
+# `packageManager` field in the root `package.json`.
+npm install -g [email protected]
+hash -r
+
+echo "--- :key: Fetch Developer ID certificate"
+bundle exec fastlane set_up_signing
+
+echo "--- :hammer: Build harper-desktop (signed)"
+# `just $JUST_RECIPE` runs `pnpm tauri build -b app,dmg --target $TAURI_TARGET`
+# in `harper-desktop/`. With `APPLE_SIGNING_IDENTITY` set, Tauri's bundler signs
+# the produced .app and .dmg. `TAURI_SIGNING_PRIVATE_KEY` enables the minisign
+# updater signing.
+export APPLE_SIGNING_IDENTITY="Developer ID Application: Automattic, Inc. (PZYM8XX95Q)"
+just "$JUST_RECIPE"
+
+echo "--- :floppy_disk: Save cargo caches"
+# `save_cache` is a no-op when the key already exists in S3, so this is cheap on
+# subsequent same-deps builds. Runs after the build (so what gets cached is
+# coherent) but before notarization (a flaky notary shouldn't lose us the
+# cache). The target/ save is the one to watch — several GB of upload on a cold
+# key.
+save_cache "$HOME/.cargo/registry" "$CARGO_DEPS_KEY"
+save_cache "$HOME/.cargo/git/db" "$CARGO_DEPS_KEY-git" || true
+save_cache target "$CARGO_TARGET_KEY"
+
+echo "--- :apple: Notarize and staple"
+# Tauri signs but does not notarize when only APPLE_SIGNING_IDENTITY is set.
+# Notarize the .app and .dmg ourselves so Gatekeeper accepts them with no warning.
+APP_BUNDLE=$(find "target/$TAURI_TARGET/release/bundle/macos" -maxdepth 1 -name '*.app' -type d | head -1)
+DMG_FILE=$(find "target/$TAURI_TARGET/release/bundle/dmg" -maxdepth 1 -name '*.dmg' -type f | head -1)
+
+[ -n "$APP_BUNDLE" ] || { echo "no .app produced"; exit 1; }
+[ -n "$DMG_FILE" ] || { echo "no .dmg produced"; exit 1; }
+
+bundle exec fastlane notarize_macos package:"$APP_BUNDLE"
+bundle exec fastlane notarize_macos package:"$DMG_FILE"
+
+if [ -n "${BUILDKITE_TAG:-}" ]; then
+ echo "--- :rocket: Publish draft GitHub release"
+ APP_TARBALL=$(find "target/$TAURI_TARGET/release/bundle/macos" -maxdepth 1 -name '*.app.tar.gz' -type f | head -1)
+ APP_SIG=$(find "target/$TAURI_TARGET/release/bundle/macos" -maxdepth 1 -name '*.app.tar.gz.sig' -type f | head -1)
+ [ -n "$APP_TARBALL" ] || { echo "no .app.tar.gz produced"; exit 1; }
+ [ -n "$APP_SIG" ] || { echo "no .app.tar.gz.sig produced"; exit 1; }
+ bundle exec fastlane create_desktop_github_release \
+ tag:"$BUILDKITE_TAG" \
+ dmg:"$DMG_FILE" \
+ app_tarball:"$APP_TARBALL" \
+ app_signature:"$APP_SIG"
+fi
diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
new file mode 100644
index 000000000..a06c5d27b
--- /dev/null
+++ b/.buildkite/pipeline.yml
@@ -0,0 +1,23 @@
+# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
+---
+
+agents:
+ queue: mac
+
+env:
+ IMAGE_ID: $IMAGE_ID
+
+steps:
+ - label: ":tauri: Build, sign, notarize harper-desktop"
+ key: build-desktop
+ command: .buildkite/commands/build-desktop.sh
+ plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
+ artifact_paths:
+ # Branch/PR builds produce `aarch64-apple-darwin` artifacts; master and
+ # tag builds produce `universal-apple-darwin`. Glob both.
+ - target/*-apple-darwin/release/bundle/dmg/*.dmg
+ - target/*-apple-darwin/release/bundle/macos/*.app.tar.gz
+ - target/*-apple-darwin/release/bundle/macos/*.app.tar.gz.sig
+ notify:
+ - github_commit_status:
+ context: "Build, sign, notarize harper-desktop"
diff --git a/.buildkite/shared-pipeline-vars b/.buildkite/shared-pipeline-vars
new file mode 100644
index 000000000..41a18d962
--- /dev/null
+++ b/.buildkite/shared-pipeline-vars
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used
+# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it.
+
+XCODE_VERSION=$(sed -E 's/^~> ?//' .xcode-version)
+CI_TOOLKIT_PLUGIN_VERSION="6.1.0"
+NVM_PLUGIN_VERSION="0.6.0"
+
+export IMAGE_ID="xcode-$XCODE_VERSION"
+export CI_TOOLKIT_PLUGIN="automattic/a8c-ci-toolkit#$CI_TOOLKIT_PLUGIN_VERSION"
+export NVM_PLUGIN="automattic/nvm#$NVM_PLUGIN_VERSION"
diff --git a/.bundle/config b/.bundle/config
new file mode 100644
index 000000000..236922881
--- /dev/null
+++ b/.bundle/config
@@ -0,0 +1,2 @@
+---
+BUNDLE_PATH: "vendor/bundle"
diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml
deleted file mode 100644
index 7d4b92a52..000000000
--- a/.github/workflows/desktop.yml
+++ /dev/null
@@ -1,98 +0,0 @@
-name: Harper Desktop
-
-on:
- push:
- branches: ["master"]
- tags: ["v*"]
- pull_request:
- branches: ["master"]
- merge_group:
-
-permissions:
- contents: write
-
-jobs:
- desktop:
- name: ${{ matrix.platform.name }}
- runs-on: ${{ matrix.platform.os }}
- strategy:
- matrix:
- platform:
- - name: macOS arm64
- artifact_name: harper-desktop-macos-universal
- os: macos-14
- command: just build-desktop-macos
- unsigned_command: just build-desktop-macos-unsigned
- artifact_paths: |
- target/universal-apple-darwin/release/bundle/dmg/*.dmg
- target/universal-apple-darwin/release/bundle/macos/*.app.tar.gz
- target/universal-apple-darwin/release/bundle/macos/*.app.tar.gz.sig
- unsigned_artifact_paths: |
- target/universal-apple-darwin/release/bundle/dmg/*.dmg
-
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Setup Just
- uses: extractions/setup-just@v2
- - name: Install pnpm
- uses: pnpm/action-setup@v4
- - name: Setup Rust
- uses: actions-rust-lang/setup-rust-toolchain@v1
- - name: Install macOS Rust targets
- if: runner.os == 'macOS'
- run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
- - name: Install Node.js
- uses: actions/setup-node@v4
- with:
- node-version-file: ".node-version"
- - name: Enable Corepack
- run: corepack enable
- - name: Install Tauri Linux dependencies
- if: runner.os == 'Linux'
- run: |
- sudo apt-get update
- sudo apt-get install -y \
- libayatana-appindicator3-dev \
- librsvg2-dev \
- libwebkit2gtk-4.1-dev \
- libxdo-dev
- sudo apt-get install -y libappindicator3-dev || true
- - name: Rust Cache
- uses: Swatinem/[email protected]
- - name: Install cargo-binstall
- uses: cargo-bins/cargo-binstall@main
- - name: Install wasm-pack
- run: cargo binstall wasm-pack --force --no-confirm
- - name: Install tauri-cli
- run: cargo binstall tauri-cli --force --no-confirm
- - name: Build Harper Desktop
- if: startsWith(github.ref, 'refs/tags/v')
- env:
- TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.HARPER_DESKTOP_PRIVATE_KEY }}
- TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.HARPER_DESKTOP_PASSWORD }}
- run: ${{ matrix.platform.command }}
- - name: Build Harper Desktop without signing
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
- run: ${{ matrix.platform.unsigned_command }}
- - name: Upload signed artifacts
- if: startsWith(github.ref, 'refs/tags/v')
- uses: actions/upload-artifact@v4
- with:
- name: ${{ matrix.platform.artifact_name }}
- path: ${{ matrix.platform.artifact_paths }}
- if-no-files-found: error
- - name: Upload unsigned artifacts
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
- uses: actions/upload-artifact@v4
- with:
- name: ${{ matrix.platform.artifact_name }}
- path: ${{ matrix.platform.unsigned_artifact_paths }}
- if-no-files-found: error
- - name: Release artifacts
- if: startsWith(github.ref, 'refs/tags/v')
- uses: ncipollo/release-action@v1
- with:
- artifacts: ${{ matrix.platform.artifact_paths }}
- allowUpdates: true
- draft: true
diff --git a/.gitignore b/.gitignore
index 13d23a89a..fa631d3e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,10 @@ mariadb_data
# Ignore direnv files
.direnv/*
+
+# Fastlane / Bundler
+vendor/bundle/
+.bundle/*
+!.bundle/config
+fastlane/report.xml
+fastlane/README.md
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 000000000..5bf4400f2
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+24.15.0
diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 000000000..a0891f563
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+3.3.4
diff --git a/.xcode-version b/.xcode-version
new file mode 100644
index 000000000..58eede2a6
--- /dev/null
+++ b/.xcode-version
@@ -0,0 +1 @@
+26.5
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 000000000..ce64d6d04
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+source 'https://rubygems.org'
+
+gem 'fastlane', '~> 2.233'
+gem 'fastlane-plugin-wpmreleasetoolkit', '~> 14.6'
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 000000000..59dae5fd6
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,318 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ CFPropertyList (3.0.8)
+ abbrev (0.1.2)
+ addressable (2.9.0)
+ public_suffix (>= 2.0.2, < 8.0)
+ artifactory (3.0.17)
+ atomos (0.1.3)
+ aws-eventstream (1.4.0)
+ aws-partitions (1.1253.0)
+ aws-sdk-core (3.249.0)
+ aws-eventstream (~> 1, >= 1.3.0)
+ aws-partitions (~> 1, >= 1.992.0)
+ aws-sigv4 (~> 1.9)
+ base64
+ bigdecimal
+ jmespath (~> 1, >= 1.6.1)
+ logger
+ aws-sdk-kms (1.128.0)
+ aws-sdk-core (~> 3, >= 3.248.0)
+ aws-sigv4 (~> 1.5)
+ aws-sdk-s3 (1.224.0)
+ aws-sdk-core (~> 3, >= 3.248.0)
+ aws-sdk-kms (~> 1)
+ aws-sigv4 (~> 1.5)
+ aws-sigv4 (1.12.1)
+ aws-eventstream (~> 1, >= 1.0.2)
+ babosa (1.0.4)
+ base64 (0.3.0)
+ benchmark (0.5.0)
+ bigdecimal (4.1.2)
+ buildkit (1.6.1)
+ sawyer (>= 0.6)
+ chroma (0.2.0)
+ claide (1.1.0)
+ colored (1.2)
+ colored2 (3.1.2)
+ commander (4.6.0)
+ highline (~> 2.0.0)
+ csv (3.3.5)
+ declarative (0.0.20)
+ diffy (3.4.4)
+ digest-crc (0.7.0)
+ rake (>= 12.0.0, < 14.0.0)
+ domain_name (0.6.20240107)
+ dotenv (2.8.1)
+ emoji_regex (3.2.3)
+ erubi (1.13.1)
+ excon (0.112.0)
+ faraday (1.10.5)
+ faraday-em_http (~> 1.0)
+ faraday-em_synchrony (~> 1.0)
+ faraday-excon (~> 1.1)
+ faraday-httpclient (~> 1.0)
+ faraday-multipart (~> 1.0)
+ faraday-net_http (~> 1.0)
+ faraday-net_http_persistent (~> 1.0)
+ faraday-patron (~> 1.0)
+ faraday-rack (~> 1.0)
+ faraday-retry (~> 1.0)
+ ruby2_keywords (>= 0.0.4)
+ faraday-cookie_jar (0.0.8)
+ faraday (>= 0.8.0)
+ http-cookie (>= 1.0.0)
+ faraday-em_http (1.0.0)
+ faraday-em_synchrony (1.0.1)
+ faraday-excon (1.1.0)
+ faraday-httpclient (1.0.1)
+ faraday-multipart (1.2.0)
+ multipart-post (~> 2.0)
+ faraday-net_http (1.0.2)
+ faraday-net_http_persistent (1.2.0)
+ faraday-patron (1.0.0)
+ faraday-rack (1.0.0)
+ faraday-retry (1.0.4)
+ faraday_middleware (1.2.1)
+ faraday (~> 1.0)
+ fastimage (2.4.1)
+ fastlane (2.234.0)
+ CFPropertyList (>= 2.3, < 5.0.0)
+ abbrev (~> 0.1)
+ addressable (>= 2.8, < 3.0.0)
+ artifactory (~> 3.0)
+ aws-sdk-s3 (~> 1.197)
+ babosa (>= 1.0.3, < 2.0.0)
+ base64 (~> 0.2)
+ benchmark (>= 0.1.0)
+ bundler (>= 1.17.3, < 5.0.0)
+ colored (~> 1.2)
+ commander (~> 4.6)
+ csv (~> 3.3)
+ dotenv (>= 2.1.1, < 3.0.0)
+ emoji_regex (>= 0.1, < 4.0)
+ excon (>= 0.71.0, < 1.0.0)
+ faraday (~> 1.0)
+ faraday-cookie_jar (~> 0.0.6)
+ faraday_middleware (~> 1.0)
+ fastimage (>= 2.1.0, < 3.0.0)
+ fastlane-sirp (>= 1.1.0)
+ gh_inspector (>= 1.1.2, < 2.0.0)
+ google-apis-androidpublisher_v3 (~> 0.3)
+ google-apis-playcustomapp_v1 (~> 0.1)
+ google-cloud-env (>= 1.6.0, <= 2.1.1)
+ google-cloud-storage (~> 1.31)
+ highline (~> 2.0)
+ http-cookie (~> 1.0.5)
+ json (< 3.0.0)
+ jwt (>= 2.1.0, < 3)
+ logger (>= 1.6, < 2.0)
+ mini_magick (>= 4.9.4, < 5.0.0)
+ multipart-post (>= 2.0.0, < 3.0.0)
+ mutex_m (~> 0.3)
+ naturally (~> 2.2)
+ nkf (~> 0.2)
+ optparse (>= 0.1.1, < 1.0.0)
+ ostruct (>= 0.1.0)
+ plist (>= 3.1.0, < 4.0.0)
+ rubyzip (>= 2.0.0, < 3.0.0)
+ security (= 0.1.5)
+ simctl (~> 1.6.3)
+ terminal-notifier (>= 2.0.0, < 3.0.0)
+ terminal-table (~> 3)
+ tty-screen (>= 0.6.3, < 1.0.0)
+ tty-spinner (>= 0.8.0, < 1.0.0)
+ word_wrap (~> 1.0.0)
+ xcodeproj (>= 1.13.0, < 2.0.0)
+ xcpretty (~> 0.4.1)
+ xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
+ fastlane-plugin-wpmreleasetoolkit (14.6.0)
+ buildkit (~> 1.5)
+ chroma (= 0.2.0)
+ diffy (~> 3.3)
+ dotenv (~> 2.8)
+ fastlane (~> 2.231)
+ gettext (~> 3.5)
+ git (~> 1.3)
+ google-cloud-storage (~> 1.31)
+ java-properties (~> 0.3.0)
+ nokogiri (~> 1.19, >= 1.19.3)
+ octokit (~> 6.1)
+ parallel (~> 1.14)
+ plist (~> 3.1)
+ progress_bar (~> 1.3)
+ rake (>= 12.3, < 14.0)
+ rake-compiler (~> 1.0)
+ xcodeproj (~> 1.22)
+ fastlane-sirp (1.1.0)
+ fiddle (1.1.8)
+ forwardable (1.4.0)
+ gettext (3.5.2)
+ erubi
+ locale (>= 2.0.5)
+ prime
+ racc
+ text (>= 1.3.0)
+ gh_inspector (1.1.3)
+ git (1.19.1)
+ addressable (~> 2.8)
+ rchardet (~> 1.8)
+ google-apis-androidpublisher_v3 (0.101.0)
+ google-apis-core (>= 0.15.0, < 2.a)
+ google-apis-core (0.18.0)
+ addressable (~> 2.5, >= 2.5.1)
+ googleauth (~> 1.9)
+ httpclient (>= 2.8.3, < 3.a)
+ mini_mime (~> 1.0)
+ mutex_m
+ representable (~> 3.0)
+ retriable (>= 2.0, < 4.a)
+ google-apis-iamcredentials_v1 (0.27.0)
+ google-apis-core (>= 0.15.0, < 2.a)
+ google-apis-playcustomapp_v1 (0.17.0)
+ google-apis-core (>= 0.15.0, < 2.a)
+ google-apis-storage_v1 (0.62.0)
+ google-apis-core (>= 0.15.0, < 2.a)
+ google-cloud-core (1.8.0)
+ google-cloud-env (>= 1.0, < 3.a)
+ google-cloud-errors (~> 1.0)
+ google-cloud-env (2.1.1)
+ faraday (>= 1.0, < 3.a)
+ google-cloud-errors (1.6.0)
+ google-cloud-storage (1.60.0)
+ addressable (~> 2.8)
+ digest-crc (~> 0.4)
+ google-apis-core (>= 0.18, < 2)
+ google-apis-iamcredentials_v1 (~> 0.18)
+ google-apis-storage_v1 (>= 0.42)
+ google-cloud-core (~> 1.6)
+ googleauth (~> 1.9)
+ mini_mime (~> 1.0)
+ googleauth (1.11.2)
+ faraday (>= 1.0, < 3.a)
+ google-cloud-env (~> 2.1)
+ jwt (>= 1.4, < 3.0)
+ multi_json (~> 1.11)
+ os (>= 0.9, < 2.0)
+ signet (>= 0.16, < 2.a)
+ highline (2.0.3)
+ http-cookie (1.0.8)
+ domain_name (~> 0.5)
+ httpclient (2.9.0)
+ mutex_m
+ java-properties (0.3.0)
+ jmespath (1.6.2)
+ json (2.19.5)
+ jwt (2.10.3)
+ base64
+ locale (2.1.5)
+ fiddle
+ logger (1.7.0)
+ mini_magick (4.13.2)
+ mini_mime (1.1.5)
+ multi_json (1.21.1)
+ multipart-post (2.4.1)
+ mutex_m (0.3.0)
+ nanaimo (0.4.0)
+ naturally (2.3.0)
+ nkf (0.2.0)
+ nokogiri (1.19.3-aarch64-linux-gnu)
+ racc (~> 1.4)
+ nokogiri (1.19.3-aarch64-linux-musl)
+ racc (~> 1.4)
+ nokogiri (1.19.3-arm-linux-gnu)
+ racc (~> 1.4)
+ nokogiri (1.19.3-arm-linux-musl)
+ racc (~> 1.4)
+ nokogiri (1.19.3-arm64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.19.3-x86_64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.19.3-x86_64-linux-gnu)
+ racc (~> 1.4)
+ nokogiri (1.19.3-x86_64-linux-musl)
+ racc (~> 1.4)
+ octokit (6.1.1)
+ faraday (>= 1, < 3)
+ sawyer (~> 0.9)
+ options (2.3.2)
+ optparse (0.8.1)
+ os (1.1.4)
+ ostruct (0.6.3)
+ parallel (1.28.0)
+ plist (3.7.2)
+ prime (0.1.4)
+ forwardable
+ singleton
+ progress_bar (1.3.4)
+ highline (>= 1.6)
+ options (~> 2.3.0)
+ public_suffix (7.0.5)
+ racc (1.8.1)
+ rake (13.4.2)
+ rake-compiler (1.3.1)
+ rake
+ rchardet (1.10.0)
+ representable (3.2.0)
+ declarative (< 0.1.0)
+ trailblazer-option (>= 0.1.1, < 0.2.0)
+ uber (< 0.2.0)
+ retriable (3.5.0)
+ rexml (3.4.4)
+ rouge (3.28.0)
+ ruby2_keywords (0.0.5)
+ rubyzip (2.4.1)
+ sawyer (0.9.3)
+ addressable (>= 2.3.5)
+ faraday (>= 0.17.3, < 3)
+ security (0.1.5)
+ signet (0.21.0)
+ addressable (~> 2.8)
+ faraday (>= 0.17.5, < 3.a)
+ jwt (>= 1.5, < 4.0)
+ multi_json (~> 1.10)
+ simctl (1.6.10)
+ CFPropertyList
+ naturally
+ singleton (0.3.0)
+ terminal-notifier (2.0.0)
+ terminal-table (3.0.2)
+ unicode-display_width (>= 1.1.1, < 3)
+ text (1.3.1)
+ trailblazer-option (0.1.2)
+ tty-cursor (0.7.1)
+ tty-screen (0.8.2)
+ tty-spinner (0.9.3)
+ tty-cursor (~> 0.7)
+ uber (0.1.0)
+ unicode-display_width (2.6.0)
+ word_wrap (1.0.0)
+ xcodeproj (1.27.0)
+ CFPropertyList (>= 2.3.3, < 4.0)
+ atomos (~> 0.1.3)
+ claide (>= 1.0.2, < 2.0)
+ colored2 (~> 3.1)
+ nanaimo (~> 0.4.0)
+ rexml (>= 3.3.6, < 4.0)
+ xcpretty (0.4.1)
+ rouge (~> 3.28.0)
+ xcpretty-travis-formatter (1.0.1)
+ xcpretty (~> 0.2, >= 0.0.7)
+
+PLATFORMS
+ aarch64-linux-gnu
+ aarch64-linux-musl
+ arm-linux-gnu
+ arm-linux-musl
+ arm64-darwin
+ x86_64-darwin
+ x86_64-linux-gnu
+ x86_64-linux-musl
+
+DEPENDENCIES
+ fastlane (~> 2.233)
+ fastlane-plugin-wpmreleasetoolkit (~> 14.6)
+
+BUNDLED WITH
+ 2.5.11
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
new file mode 100644
index 000000000..9d447a820
--- /dev/null
+++ b/fastlane/Fastfile
@@ -0,0 +1,103 @@
+# frozen_string_literal: true
+
+UI.user_error!('Please run fastlane via `bundle exec`') unless FastlaneCore::Helper.bundler?
+
+APPLE_TEAM_ID = 'PZYM8XX95Q'
+
+GITHUB_REPO = 'Automattic/harper'
+
+TAURI_CONFIG_PATH = File.expand_path('../harper-desktop/src-tauri/tauri.conf.json', __dir__)
+
+CODE_SIGNING_STORAGE_OPTIONS = {
+ storage_mode: 's3',
+ s3_bucket: 'a8c-fastlane-match',
+ s3_region: 'us-east-2'
+}.freeze
+
+CODE_SIGNING_ENV_VARS = %w[
+ MATCH_S3_ACCESS_KEY
+ MATCH_S3_SECRET_ACCESS_KEY
+ MATCH_PASSWORD
+].freeze
+
+ASC_API_KEY_ENV_VARS = %w[
+ APP_STORE_CONNECT_API_KEY_KEY_ID
+ APP_STORE_CONNECT_API_KEY_ISSUER_ID
+ APP_STORE_CONNECT_API_KEY_KEY
+].freeze
+
+require 'json'
+require 'tempfile'
+require 'fastlane/plugin/wpmreleasetoolkit'
+
+# Convenience alias — wpmreleasetoolkit 14.4+ namespaces this under
+# Fastlane::Wpmreleasetoolkit but exposes no top-level shortcut.
+EnvManager = Fastlane::Wpmreleasetoolkit::EnvManager
+
+before_all do
+ # Ensures match works correctly in CI by setting up a temporary keychain.
+ # No-op locally, so safe to run unconditionally.
+ setup_ci
+
+ # No `.env` file in this repo today — env vars come from the Buildkite agent.
+ # `set_up` still needed so EnvManager has a configured instance.
+ EnvManager.set_up(env_file_name: 'harper-desktop.env')
+end
+
+desc 'Fetch the Developer ID Application certificate into the keychain'
+lane :set_up_signing do |readonly: true|
+ CODE_SIGNING_ENV_VARS.each { |k| EnvManager.get_required_env!(k) }
+ ASC_API_KEY_ENV_VARS.each { |k| EnvManager.get_required_env!(k) } unless readonly
+
+ sync_code_signing(
+ type: 'developer_id',
+ platform: 'macos',
+ team_id: APPLE_TEAM_ID,
+ # Developer ID cert is team-wide; no per-app storage key needed.
+ app_identifier: [],
+ api_key: readonly ? nil : app_store_connect_api_key,
+ readonly: readonly,
+ **CODE_SIGNING_STORAGE_OPTIONS
+ )
+end
+
+desc 'Submit a signed .app or .dmg to Apple for notarization and staple the ticket'
+lane :notarize_macos do |package:|
+ ASC_API_KEY_ENV_VARS.each { |k| EnvManager.get_required_env!(k) }
+
+ # `bundle_id` is required by the action for validation, even
+ # though notarytool itself doesn't need it. For .app the
+ # action would auto-read it from Info.plist; for .dmg we must
+ # supply it.
+ bundle_id = JSON.parse(File.read(TAURI_CONFIG_PATH)).fetch('identifier')
+
+ notarize(
+ package: package,
+ bundle_id: bundle_id,
+ api_key: app_store_connect_api_key,
+ print_log: true
+ )
+end
+
+desc 'Create a draft GitHub release for harper-desktop with the signed/notarized macOS artifacts attached'
+lane :create_desktop_github_release do |tag:, dmg:, app_tarball:, app_signature:|
+ EnvManager.get_required_env!('GITHUB_TOKEN')
+
+ # `create_github_release` is create-only — a re-run on an existing tag
+ # requires deleting the partial draft on GitHub before retrying.
+
+ # `create_github_release` crashes with a FrozenError when no notes path is
+ # given (wpmreleasetoolkit 14.6.0 calls `gsub!` on a frozen empty literal).
+ # Pass an empty tempfile to get the action's intended "no notes" behavior.
+ Tempfile.create(['release-notes', '.md']) do |empty_notes|
+ empty_notes.close
+
+ create_github_release(
+ repository: GITHUB_REPO,
+ version: tag,
+ release_assets: [dmg, app_tarball, app_signature],
+ release_notes_file_path: empty_notes.path,
+ is_draft: true
+ )
+ end
+end
diff --git a/fastlane/Matchfile b/fastlane/Matchfile
new file mode 100644
index 000000000..e69de29bb
diff --git a/harper-desktop/src-tauri/tauri.conf.json b/harper-desktop/src-tauri/tauri.conf.json
index 8971af305..e20a17b3d 100644
--- a/harper-desktop/src-tauri/tauri.conf.json
+++ b/harper-desktop/src-tauri/tauri.conf.json
@@ -32,7 +32,7 @@
},
"plugins": {
"updater": {
- "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDY4OEU5REVGQzc2MDk4QzkKUldUSm1HREg3NTJPYUNPd1VwT3kxUm5kc3VhKzcrK2FaV3hYemdacVNWb3NvVnJsYndqWUJObC8K",
+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEVFREI1NzQ2NjNFMTgyREQKUldUZGd1RmpSbGZiN3BieGRYZjUxZVhWZDRBcWVlTVlHa3BMa2tIdDZVVDFsWHUyZkplMDU1S2QK",
"endpoints": [
"https://writewithharper.com/download-harper-desktop/{{target}}/{{arch}}/{{current_version}}"
]
diff --git a/justfile b/justfile
index b171577a1..06d4726a8 100644
--- a/justfile
+++ b/justfile
@@ -168,7 +168,7 @@ dev-desktop: build-harperjs build-lint-framework build-components build-harper-e
cd "{{justfile_directory()}}/harper-desktop"
pnpm install
- cargo tauri dev
+ pnpm tauri dev
# Start the Harper Desktop highlighter process directly.
dev-desktop-highlighter:
@@ -196,7 +196,16 @@ build-desktop-linux: build-harperjs build-lint-framework build-components build-
cd "{{justfile_directory()}}/harper-desktop"
pnpm install
- cargo tauri build -b deb,rpm,appimage
+ pnpm tauri build -b deb,rpm,appimage
+
+# Build Harper Desktop for Apple Silicon only — faster than the universal recipe below.
+build-desktop-macos-arm64: build-harperjs build-lint-framework build-components build-harper-editor
+ #!/usr/bin/env bash
+ set -eo pipefail
+
+ cd "{{justfile_directory()}}/harper-desktop"
+ pnpm install
+ pnpm tauri build -b app,dmg --target aarch64-apple-darwin
# Build Harper Desktop macOS bundles.
build-desktop-macos: build-harperjs build-lint-framework build-components build-harper-editor
@@ -205,7 +214,7 @@ build-desktop-macos: build-harperjs build-lint-framework build-components build-
cd "{{justfile_directory()}}/harper-desktop"
pnpm install
- cargo tauri build -b app,dmg --target universal-apple-darwin
+ pnpm tauri build -b app,dmg --target universal-apple-darwin
# Build Harper Desktop macOS bundles without updater artifacts.
build-desktop-macos-unsigned: build-harperjs build-lint-framework build-components build-harper-editor
@@ -214,7 +223,7 @@ build-desktop-macos-unsigned: build-harperjs build-lint-framework build-componen
cd "{{justfile_directory()}}/harper-desktop"
pnpm install
- cargo tauri build -b app,dmg --config '{"bundle":{"createUpdaterArtifacts":false}}' --target universal-apple-darwin
+ pnpm tauri build -b app,dmg --config '{"bundle":{"createUpdaterArtifacts":false}}' --target universal-apple-darwin
# Build the Harper Obsidian plugin.
build-obsidian: build-harperjs