All your machines, one app. For you and your AI agents: agent sessions, desktops, files, logs and GitHub across your Macs, Linux and Windows machines, with an MCP server.
Release pipeline: CI, signed and notarized builds for every platform
Adib Hanna29188f0db3ed
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlnew file mode 100644index 0000000..eece60d--- /dev/null+++ b/.github/workflows/ci.yml@@ -0,0 +1,52 @@+# Tests on every push to main and every pull request: the app and the agent on+# macOS and Linux, and a build on Windows (GPUI's Windows backend only builds+# there, so this is where Windows breakage shows up).+name: ci++on:+ push:+ branches: [main]+ pull_request:+ workflow_dispatch:++concurrency:+ group: ci-${{ github.ref }}+ cancel-in-progress: true++env:+ CARGO_TERM_COLOR: always++jobs:+ macos:+ runs-on: macos-15+ steps:+ - uses: actions/checkout@v5+ - uses: dtolnay/rust-toolchain@stable+ - uses: Swatinem/rust-cache@v2+ - run: cargo test --workspace --locked++ linux:+ runs-on: ubuntu-22.04+ steps:+ - uses: actions/checkout@v5+ - name: GPUI's libraries+ run: |+ sudo apt-get update -qq+ sudo apt-get install -y -qq libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libvulkan-dev libfontconfig-dev libx11-xcb-dev libxcb1-dev+ - uses: dtolnay/rust-toolchain@stable+ - uses: Swatinem/rust-cache@v2+ - run: cargo test --workspace --locked++ windows:+ runs-on: windows-2022+ steps:+ - uses: actions/checkout@v5+ - uses: dtolnay/rust-toolchain@stable+ - uses: Swatinem/rust-cache@v2+ - name: The Windows SDK's shader compiler, for GPUI+ shell: pwsh+ run: |+ $fxc = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin" -Recurse -Filter fxc.exe | Where-Object { $_.FullName -match '\\x64\\' } | Sort-Object FullName -Descending | Select-Object -First 1+ "GPUI_FXC_PATH=$($fxc.FullName)" >> $env:GITHUB_ENV+ - run: cargo build --workspace --locked+ - run: cargo test -p muxen-agent --lockeddiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlnew file mode 100644index 0000000..28f73ed--- /dev/null+++ b/.github/workflows/release.yml@@ -0,0 +1,166 @@+# Builds a release for every platform when a version tag (v1.2.3) is pushed, and+# puts it in a draft GitHub release to look over and publish. scripts/release.sh+# makes the tag. Run by hand (Actions › release › Run workflow), it builds the+# same files without a release, to try the pipeline.+#+# Signed and notarized when the signing secrets are set (see RELEASING.md);+# without them the macOS app is an unsigned test build.+name: release++on:+ push:+ tags: ['v*']+ workflow_dispatch:++permissions:+ contents: write++env:+ CARGO_TERM_COLOR: always+ # Set when the Developer ID certificate is a secret: then sign and notarize.+ SIGNED: ${{ secrets.MACOS_CERT_P12 != '' }}++jobs:+ # The agent for every platform: the app ships them all and installs the right+ # one on each machine. Built on a Mac, which signs the macOS ones.+ agents:+ runs-on: macos-15+ steps:+ - uses: actions/checkout@v5+ - name: The tag matches the version+ if: startsWith(github.ref, 'refs/tags/v')+ run: |+ version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)+ [ "$GITHUB_REF_NAME" = "v$version" ] || { echo "::error::tag $GITHUB_REF_NAME, but Cargo.toml says $version"; exit 1; }+ - uses: dtolnay/rust-toolchain@stable+ with:+ targets: aarch64-apple-darwin,x86_64-apple-darwin,x86_64-unknown-linux-musl,aarch64-unknown-linux-musl,x86_64-pc-windows-gnu+ - uses: Swatinem/rust-cache@v2+ - uses: mlugg/setup-zig@v2+ - uses: taiki-e/install-action@v2+ with:+ tool: cargo-zigbuild+ - name: Signing identity+ if: env.SIGNED == 'true'+ env:+ MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}+ MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}+ run: scripts/ci/macos-keychain.sh+ - run: MUXEN_RELEASE=$([ "$SIGNED" = true ] && echo 1) scripts/build-agents.sh+ - uses: actions/upload-artifact@v4+ with:+ name: agents+ path: dist/agents+ if-no-files-found: error++ macos:+ needs: agents+ runs-on: macos-15+ steps:+ - uses: actions/checkout@v5+ - uses: dtolnay/rust-toolchain@stable+ with:+ targets: aarch64-apple-darwin,x86_64-apple-darwin+ - uses: Swatinem/rust-cache@v2+ - uses: actions/download-artifact@v4+ with:+ name: agents+ path: dist/agents+ - run: chmod +x dist/agents/*+ - name: Signing identity+ if: env.SIGNED == 'true'+ env:+ MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}+ MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}+ APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }}+ run: scripts/ci/macos-keychain.sh+ - name: Build, sign and notarize+ if: env.SIGNED == 'true'+ env:+ APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}+ APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }}+ run: |+ scripts/bundle-macos.sh --release --skip-agents+ scripts/notarize-macos.sh+ - name: Build (unsigned test build)+ if: env.SIGNED != 'true'+ run: |+ scripts/bundle-macos.sh --universal --skip-agents+ scripts/notarize-macos.sh --no-notarize+ - uses: actions/upload-artifact@v4+ with:+ name: macos+ path: dist/Muxen-*-macos.dmg+ if-no-files-found: error++ linux:+ needs: agents+ # The oldest Ubuntu GitHub runs: the app needs this glibc (2.35) or newer.+ runs-on: ubuntu-22.04+ steps:+ - uses: actions/checkout@v5+ - name: GPUI's libraries+ run: |+ sudo apt-get update -qq+ sudo apt-get install -y -qq libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libvulkan-dev libfontconfig-dev libx11-xcb-dev libxcb1-dev+ - uses: dtolnay/rust-toolchain@stable+ - uses: Swatinem/rust-cache@v2+ - uses: actions/download-artifact@v4+ with:+ name: agents+ path: dist/agents+ - run: chmod +x dist/agents/*+ - run: scripts/package-linux.sh --skip-agents+ - uses: actions/upload-artifact@v4+ with:+ name: linux+ path: dist/Muxen-*-linux-*.tar.gz+ if-no-files-found: error++ windows:+ needs: agents+ runs-on: windows-2022+ steps:+ - uses: actions/checkout@v5+ - uses: dtolnay/rust-toolchain@stable+ - uses: Swatinem/rust-cache@v2+ - uses: actions/download-artifact@v4+ with:+ name: agents+ path: dist/agents+ - name: Inno Setup, for the installer+ shell: pwsh+ run: |+ if (-not (Test-Path "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe")) { choco install innosetup --no-progress -y }+ - run: scripts/package-windows.ps1+ shell: pwsh+ - uses: actions/upload-artifact@v4+ with:+ name: windows+ path: |+ dist/Muxen-*-windows-x64.zip+ dist/Muxen-*-windows-x64-setup.exe+ if-no-files-found: error++ # A draft release with every file and their checksums, for a tag.+ release:+ needs: [macos, linux, windows]+ if: startsWith(github.ref, 'refs/tags/v')+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v5+ - uses: actions/download-artifact@v4+ with:+ pattern: '{macos,linux,windows}'+ path: dist+ merge-multiple: true+ - name: Checksums+ working-directory: dist+ run: sha256sum Muxen-* > SHA256SUMS.txt && cat SHA256SUMS.txt+ - name: Draft release+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ signed=$([ "$SIGNED" = true ] && echo "" || echo " (unsigned test build)")+ gh release create "$GITHUB_REF_NAME" dist/Muxen-* dist/SHA256SUMS.txt \+ --draft --title "Muxen ${GITHUB_REF_NAME#v}$signed" --generate-notesdiff --git a/README.md b/README.mdindex d1aeb31..e1a9971 100644--- a/README.md+++ b/README.md@@ -49,9 +49,11 @@ To run `muxen` from a terminal, use **Settings › General › Command line ›To get a real app with the Muxen icon:-- **macOS:** `./scripts/bundle-macos.sh` builds `dist/Muxen.app` (ad-hoc signed). Drag it to Applications. Agents can still use the binary inside it: `Muxen.app/Contents/MacOS/muxen mcp`.-- **Linux:** install `assets/linux/muxen.desktop` and `assets/brand/icon-512.png` (as `muxen.png`).-- **Windows:** the icon is `assets/brand/muxen.ico`.+- **macOS:** `./scripts/bundle-macos.sh` builds `dist/Muxen.app`, signed with the Developer ID when it's in your keychain. Drag it to Applications. Agents can still use the binary inside it: `Muxen.app/Contents/MacOS/muxen mcp`.+- **Linux:** `./scripts/package-linux.sh` makes a tarball; its `install.sh` puts Muxen in `~/.local` with an entry in your app menu.+- **Windows:** `scripts\package-windows.ps1` makes the installer.++Releases (a notarized DMG, the Linux tarball and the Windows installer) are built by GitHub Actions from a version tag: see [RELEASING.md](RELEASING.md).## Quick startdiff --git a/RELEASING.md b/RELEASING.mdnew file mode 100644index 0000000..50db14f--- /dev/null+++ b/RELEASING.md@@ -0,0 +1,104 @@+# Releasing Muxen++A release is a version tag (`v1.2.3`). Pushing one runs the **release** workflow+(`.github/workflows/release.yml`), which builds every platform and puts the+files in a **draft** GitHub release on this repository to look over and publish.++| File | What it is |+|---|---|+| `Muxen-<version>-macos.dmg` | The app for Apple silicon and Intel Macs (macOS 12 or later), signed with the Developer ID and notarized |+| `Muxen-<version>-linux-x86_64.tar.gz` | The app for Linux (glibc 2.35 or newer: Ubuntu 22.04, Debian 12, Fedora 36 and later), with `install.sh` |+| `Muxen-<version>-windows-x64-setup.exe` | The Windows installer (for the user, no administrator needed) |+| `Muxen-<version>-windows-x64.zip` | The same, unpacked |+| `SHA256SUMS.txt` | Their checksums |++Each one carries the agent for every platform (`agents/`), which the app+installs on the machines it connects to.++## Making a release++```sh+git switch main && git pull+scripts/release.sh 0.2.0 --push+```++The script sets the version in `Cargo.toml` and `Cargo.lock`, commits it, tags+the commit `v0.2.0` and pushes both. Leave out `--push` to look first; then+`git push origin HEAD v0.2.0`.++Then:++```sh+gh run watch # the build: about 30 minutes+gh release view v0.2.0 # the draft and its files+gh release edit v0.2.0 --draft=false # publish it+```++The repository is private, so its releases are only for people with access to+it. Public downloads come later.++To try the pipeline without a release, run the workflow by hand (Actions ›+release › Run workflow, or `gh workflow run release`). It builds the same files+and keeps them on the run as artifacts.++## Signing and notarization (once)++Without these secrets the workflow still builds everything, but the macOS app+is an **unsigned test build** (macOS refuses to open it until you allow it in+System Settings › Privacy & Security), and the draft says so.++**1. The Developer ID certificate.** In Keychain Access, under login › My+Certificates, right-click **Developer ID Application: Lumary Labs LLC+(WYY7PK57DM)** › Export, as a `.p12` with a password. Then:++```sh+base64 -i DeveloperID.p12 | gh secret set MACOS_CERT_P12 -R LumaryLabsLLC/muxin+gh secret set MACOS_CERT_PASSWORD -R LumaryLabsLLC/muxin # asks for the password+rm DeveloperID.p12+```++**2. An App Store Connect API key, for the notary service.** In+[App Store Connect](https://appstoreconnect.apple.com/access/integrations/api)+› Users and Access › Integrations › Team Keys, generate a key with the+**Developer** role and download `AuthKey_<id>.p8` (Apple lets you download it+once). Note its **Key ID** and the **Issuer ID** above the list. Then:++```sh+gh secret set APPLE_API_KEY_P8 -R LumaryLabsLLC/muxin < AuthKey_<id>.p8+gh secret set APPLE_API_KEY_ID -R LumaryLabsLLC/muxin --body <key id>+gh secret set APPLE_API_ISSUER_ID -R LumaryLabsLLC/muxin --body <issuer id>+```++**3. On your Mac too** (to notarize a local build), save the same key for+`notarytool`:++```sh+xcrun notarytool store-credentials muxen --key AuthKey_<id>.p8 --key-id <key id> --issuer <issuer id>+```++Keep the `.p8` somewhere safe, like a password manager: Apple won't show it+again.++## Building by hand++| Platform | Command | Output |+|---|---|---|+| macOS | `scripts/bundle-macos.sh` | `dist/Muxen.app`, for this Mac (what you use day to day) |+| macOS release | `scripts/bundle-macos.sh --release && scripts/notarize-macos.sh` | a universal, notarized `dist/Muxen-<version>-macos.dmg` |+| Agents | `scripts/build-agents.sh` | `dist/agents/`, every platform (needs zig and cargo-zigbuild) |+| Linux | `scripts/package-linux.sh` | `dist/Muxen-<version>-linux-<arch>.tar.gz` |+| Windows | `scripts\package-windows.ps1` | the installer and zip (agents from a Mac or Linux first) |++## Not done yet++- **Windows code signing**: the installer isn't signed, so SmartScreen warns+ ("Windows protected your PC" › More info › Run anyway) until it is.+- **Public downloads** and the links on muxin.dev.+- **Updates from inside the app.**+- **The Linux app for ARM** (the agent already runs there).++## CI++`.github/workflows/ci.yml` runs on every push to `main` and every pull request:+the tests on macOS and Linux, and a Windows build. macOS minutes count ten+times against a private repository's Actions minutes, Windows twice.diff --git a/assets/linux/install.sh b/assets/linux/install.shnew file mode 100755index 0000000..633a8c2--- /dev/null+++ b/assets/linux/install.sh@@ -0,0 +1,34 @@+#!/bin/sh+# Installs Muxen for you (no root needed): the app in ~/.local/share/muxen-app,+# the `muxen` command in ~/.local/bin, and Muxen in your desktop's app menu.+# Run it again to update. `./install.sh --uninstall` takes it all out again+# (your settings in ~/.config/muxin stay).+set -eu++here=$(cd "$(dirname "$0")" && pwd)+data=${XDG_DATA_HOME:-$HOME/.local/share}+dest=$data/muxen-app+bin=$HOME/.local/bin+entry=$data/applications/muxen.desktop+icon=$data/icons/hicolor/512x512/apps/muxen.png++if [ "${1:-}" = --uninstall ]; then+ [ "$(readlink "$bin/muxen" 2>/dev/null)" = "$dest/muxen" ] && rm -f "$bin/muxen"+ rm -rf "$dest" "$entry" "$icon"+ echo "Muxen is uninstalled. Your settings are still in ~/.config/muxin."+ exit 0+fi++rm -rf "$dest"+mkdir -p "$dest" "$bin" "$(dirname "$entry")" "$(dirname "$icon")"+cp -R "$here/muxen" "$here/agents" "$dest/"+ln -sf "$dest/muxen" "$bin/muxen"+cp "$here/muxen.png" "$icon"+sed "s|^Exec=.*|Exec=$dest/muxen|" "$here/muxen.desktop" > "$entry"+command -v update-desktop-database >/dev/null && update-desktop-database "$(dirname "$entry")" 2>/dev/null || true++echo "Muxen is installed: open it from your app menu, or run \`muxen\`."+case ":$PATH:" in+ *":$bin:"*) ;;+ *) echo "To use \`muxen\` in a terminal, add $bin to your PATH." ;;+esacdiff --git a/assets/linux/muxen.desktop b/assets/linux/muxen.desktopindex b70ddf0..4e0e4c4 100644--- a/assets/linux/muxen.desktop+++ b/assets/linux/muxen.desktop@@ -1,9 +1,11 @@[Desktop Entry]Type=ApplicationName=Muxen-Comment=Run and control your self-hosted GitHub Actions runners+GenericName=Machines+Comment=All your machines, one appExec=muxenIcon=muxenTerminal=falseStartupWMClass=muxen-Categories=Development;+Categories=Development;Network;RemoteAccess;+Keywords=ssh;servers;agents;runners;diff --git a/scripts/build-agents.sh b/scripts/build-agents.shindex 0406459..f601bfc 100755--- a/scripts/build-agents.sh+++ b/scripts/build-agents.sh@@ -7,6 +7,9 @@# x86_64-unknown-linux-musl, aarch64-unknown-linux-musl, x86_64-pc-windows-gnu),# cargo-zigbuild and zig for the Linux builds (static musl binaries that run on# any distro) and the Windows one.+#+# MUXEN_RELEASE=1 signs the macOS ones for notarization (hardened runtime and a+# secure timestamp), as scripts/bundle-macos.sh --release needs.set -eucd "$(dirname "$0")/.."out=dist/agents@@ -26,11 +29,20 @@ case "$(uname -s)" in# and Accessibility permissions across updates (an ad-hoc signature# changes with every build, and the permissions go with it).identity=${MUXEN_SIGN_IDENTITY:-$(security find-identity -v -p codesigning 2>/dev/null | sed -n 's/.*"\(Developer ID Application: [^"]*\)".*/\1/p' | head -n1)}+ if [ "${MUXEN_RELEASE:-}" = 1 ]; then+ sign_flags="--options runtime --timestamp"+ else+ sign_flags="--timestamp=none"+ fiif [ -n "$identity" ]; thenfor f in "$out"/muxen-agent-darwin-*; do- codesign --force --timestamp=none --identifier com.lumarylabs.muxen-agent -s "$identity" "$f"+ # shellcheck disable=SC2086+ codesign --force $sign_flags --identifier com.lumarylabs.muxen-agent -s "$identity" "$f"doneecho "▸ signed the macOS agents ($identity)"+ elif [ "${MUXEN_RELEASE:-}" = 1 ]; then+ echo "error: a release needs a Developer ID Application certificate in the keychain" >&2+ exit 1elseecho "▸ no Developer ID certificate: the macOS agents are ad-hoc signed"fidiff --git a/scripts/bundle-macos.sh b/scripts/bundle-macos.shindex 63cce69..f6e4694 100755--- a/scripts/bundle-macos.sh+++ b/scripts/bundle-macos.sh@@ -2,18 +2,49 @@# Builds Muxen.app (release build + Info.plist + icon) into dist/.# The bundle runs the same binary: with no arguments it opens the window, and# `Muxen.app/Contents/MacOS/muxen mcp` still works for agents.+#+# --universal one app for Apple silicon and Intel Macs.+# --release --universal, signed for notarization: hardened runtime and a+# secure timestamp. Needs the Developer ID certificate.+# scripts/notarize-macos.sh then notarizes it and makes the DMG.+# --skip-agents use the agent builds already in dist/agents (CI builds them+# in a job of their own).set -eucd "$(dirname "$0")/.."+release=+universal=+skip_agents=+for arg in "$@"; do+ case $arg in+ --release) release=1 universal=1 ;;+ --universal) universal=1 ;;+ --skip-agents) skip_agents=1 ;;+ *) echo "usage: $0 [--universal | --release] [--skip-agents]" >&2; exit 2 ;;+ esac+doneversion=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)app=dist/Muxen.app-cargo build --release+if [ -n "$universal" ]; then+ cargo build --release --locked --target aarch64-apple-darwin+ cargo build --release --locked --target x86_64-apple-darwin+ mkdir -p target/universal+ lipo -create -output target/universal/muxen \+ target/aarch64-apple-darwin/release/muxen target/x86_64-apple-darwin/release/muxen+ binary=target/universal/muxen+else+ cargo build --release+ binary=target/release/muxen+fi# The agent builds the app installs on each machine it connects to.-./scripts/build-agents.sh >/dev/null+if [ -z "$skip_agents" ]; then+ MUXEN_RELEASE=$release ./scripts/build-agents.sh >/dev/null+fi+ls dist/agents/muxen-agent-* >/dev/null 2>&1 || { echo "error: no agent builds in dist/agents" >&2; exit 1; }rm -rf "$app"mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources/agents"-cp target/release/muxen "$app/Contents/MacOS/muxen"+cp "$binary" "$app/Contents/MacOS/muxen"cp assets/brand/Muxen.icns "$app/Contents/Resources/Muxen.icns"cp dist/agents/muxen-agent-* "$app/Contents/Resources/agents/"@@ -33,6 +64,7 @@ cat > "$app/Contents/Info.plist" <<PLIST<key>LSMinimumSystemVersion</key><string>12.0</string><key>LSApplicationCategoryType</key><string>public.app-category.developer-tools</string><key>NSHighResolutionCapable</key><true/>+ <key>NSHumanReadableCopyright</key><string>© Lumary Labs LLC</string><key>NSLocalNetworkUsageDescription</key><string>Muxen connects straight to your machines on your local network: faster than going through ssh or a VPN, and needed to show their desktops smoothly.</string></dict></plist>@@ -44,9 +76,13 @@ PLIST# agents inside are already signed with their own identifier, which the# permissions on the user's Macs (Screen Recording, Accessibility) belong to.identity=${MUXEN_SIGN_IDENTITY:-$(security find-identity -v -p codesigning 2>/dev/null | sed -n 's/.*"\(Developer ID Application: [^"]*\)".*/\1/p' | head -n1)}-if [ -n "$identity" ]; then+if [ -n "$release" ]; then+ [ -n "$identity" ] || { echo "error: a release needs a Developer ID Application certificate in the keychain" >&2; exit 1; }+ codesign --force --options runtime --timestamp --identifier com.lumarylabs.muxen -s "$identity" "$app"+ codesign --verify --strict --verbose=2 "$app"+elif [ -n "$identity" ]; thencodesign --force --timestamp=none --identifier com.lumarylabs.muxen -s "$identity" "$app" >/dev/null 2>&1 || echo "warning: signing with $identity failed" >&2elsecodesign --force --sign - "$app" >/dev/null 2>&1 || echo "warning: codesign failed; the app still runs locally" >&2fi-echo "Built $app"+echo "Built $app ($version)"diff --git a/scripts/ci/macos-keychain.sh b/scripts/ci/macos-keychain.shnew file mode 100755index 0000000..368e87c--- /dev/null+++ b/scripts/ci/macos-keychain.sh@@ -0,0 +1,26 @@+#!/bin/sh+# CI only: puts the Developer ID certificate (MACOS_CERT_P12, base64 of the .p12,+# and MACOS_CERT_PASSWORD) in a keychain of its own on the build machine, for+# codesign. And, when an App Store Connect API key is given (APPLE_API_KEY_P8,+# the .p8's contents), writes it where scripts/notarize-macos.sh finds it.+# The runner, and everything on it, is thrown away after the job.+set -eu++keychain=$RUNNER_TEMP/muxen-signing.keychain-db+password=$(openssl rand -hex 24)+printf '%s' "$MACOS_CERT_P12" | base64 --decode > "$RUNNER_TEMP/cert.p12"+security create-keychain -p "$password" "$keychain"+security set-keychain-settings -lut 21600 "$keychain"+security unlock-keychain -p "$password" "$keychain"+security import "$RUNNER_TEMP/cert.p12" -k "$keychain" -P "$MACOS_CERT_PASSWORD" -T /usr/bin/codesign+security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$password" "$keychain" >/dev/null+security list-keychains -d user -s "$keychain" $(security list-keychains -d user | tr -d '"')+rm -f "$RUNNER_TEMP/cert.p12"+security find-identity -v -p codesigning "$keychain" | grep -q "Developer ID Application" \+ || { echo "error: no Developer ID Application identity in MACOS_CERT_P12" >&2; exit 1; }++if [ -n "${APPLE_API_KEY_P8:-}" ]; then+ printf '%s\n' "$APPLE_API_KEY_P8" > "$RUNNER_TEMP/AuthKey.p8"+ echo "APPLE_API_KEY_PATH=$RUNNER_TEMP/AuthKey.p8" >> "$GITHUB_ENV"+fi+echo "▸ signing identity ready"diff --git a/scripts/notarize-macos.sh b/scripts/notarize-macos.shnew file mode 100755index 0000000..a50f8f8--- /dev/null+++ b/scripts/notarize-macos.sh@@ -0,0 +1,74 @@+#!/bin/sh+# Notarizes dist/Muxen.app (built by scripts/bundle-macos.sh --release), staples+# it, and packs it into dist/Muxen-<version>-macos.dmg, itself signed, notarized+# and stapled, so it opens without a warning even offline.+#+# --no-notarize only make the DMG, as it is (for a test build: macOS warns+# about an app that isn't notarized).+#+# Apple's notary service needs one of:+# APPLE_API_KEY_PATH, APPLE_API_KEY_ID, APPLE_API_ISSUER_ID: an App Store+# Connect API key (what CI uses), or+# a notarytool keychain profile, MUXEN_NOTARY_PROFILE (default "muxen"),+# saved once with `xcrun notarytool store-credentials muxen ...`.+# See RELEASING.md.+set -eu++cd "$(dirname "$0")/.."+notarize=1+case "${1:-}" in+ --no-notarize) notarize= ;;+ "") ;;+ *) echo "usage: $0 [--no-notarize]" >&2; exit 2 ;;+esac+app=dist/Muxen.app+version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)+dmg=dist/Muxen-$version-macos.dmg+[ -d "$app" ] || { echo "error: no $app: run scripts/bundle-macos.sh --release first" >&2; exit 1; }++if [ -n "${APPLE_API_KEY_PATH:-}" ]; then+ set -- --key "$APPLE_API_KEY_PATH" --key-id "$APPLE_API_KEY_ID" --issuer "$APPLE_API_ISSUER_ID"+else+ set -- --keychain-profile "${MUXEN_NOTARY_PROFILE:-muxen}"+fi++# Sends a file to the notary service and waits; shows Apple's log when it's refused.+notarize() { # <file> <credentials...>+ file=$1+ shift+ echo "▸ notarizing $(basename "$file")"+ out=$(xcrun notarytool submit "$file" "$@" --wait --output-format json) || true+ status=$(printf '%s' "$out" | sed -n 's/.*"status":"\([^"]*\)".*/\1/p')+ id=$(printf '%s' "$out" | sed -n 's/.*"id":"\([^"]*\)".*/\1/p')+ if [ "$status" != "Accepted" ]; then+ echo "error: notarization ${status:-failed}: $out" >&2+ [ -n "$id" ] && xcrun notarytool log "$id" "$@" >&2 || true+ exit 1+ fi+}++work=$(mktemp -d)+trap 'rm -rf "$work"' EXIT++# The app first, so it's stapled (and opens offline) once it's out of the DMG.+if [ -n "$notarize" ]; then+ codesign --verify --strict "$app"+ ditto -c -k --keepParent "$app" "$work/Muxen.zip"+ notarize "$work/Muxen.zip" "$@"+ xcrun stapler staple "$app"+fi++# Then the DMG: the app and a link to Applications to drag it to.+mkdir "$work/dmg"+ditto "$app" "$work/dmg/Muxen.app"+ln -s /Applications "$work/dmg/Applications"+rm -f "$dmg"+hdiutil create -quiet -volname "Muxen $version" -srcfolder "$work/dmg" -fs HFS+ -format UDZO "$dmg"+if [ -n "$notarize" ]; then+ identity=${MUXEN_SIGN_IDENTITY:-$(security find-identity -v -p codesigning 2>/dev/null | sed -n 's/.*"\(Developer ID Application: [^"]*\)".*/\1/p' | head -n1)}+ codesign --force --timestamp -s "$identity" "$dmg"+ notarize "$dmg" "$@"+ xcrun stapler staple "$dmg"+ spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg"+fi+echo "Built $dmg ($(du -h "$dmg" | cut -f1))"diff --git a/scripts/package-linux.sh b/scripts/package-linux.shnew file mode 100755index 0000000..5cf83d8--- /dev/null+++ b/scripts/package-linux.sh@@ -0,0 +1,37 @@+#!/bin/sh+# Builds Muxen for Linux and packs it: dist/Muxen-<version>-linux-<arch>.tar.gz,+# with the app, the agent builds it sets up on each machine (agents/, made by+# scripts/build-agents.sh), a desktop entry and an install.sh that puts it in+# ~/.local for the user.+#+# Needs: Rust, and GPUI's libraries (Debian/Ubuntu: libxkbcommon-dev+# libxkbcommon-x11-dev libwayland-dev libvulkan-dev libfontconfig-dev+# libx11-xcb-dev libxcb1-dev). Build on the oldest distro you support: the app+# needs the glibc it was built with, or newer.+#+# --skip-agents use the agent builds already in dist/agents.+set -eu++cd "$(dirname "$0")/.."+skip_agents=+[ "${1:-}" = --skip-agents ] && skip_agents=1+version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)+arch=$(uname -m)++cargo build --release --locked+[ -n "$skip_agents" ] || ./scripts/build-agents.sh >/dev/null+ls dist/agents/muxen-agent-* >/dev/null 2>&1 || { echo "error: no agent builds in dist/agents" >&2; exit 1; }++root=dist/linux+out=$root/Muxen+rm -rf "$root"+mkdir -p "$out/agents"+cp target/release/muxen "$out/"+cp dist/agents/muxen-agent-* "$out/agents/"+cp assets/brand/icon-512.png "$out/muxen.png"+cp assets/linux/muxen.desktop assets/linux/install.sh "$out/"+cp README.md LICENSE THIRD_PARTY_NOTICES.md "$out/"++tarball=dist/Muxen-$version-linux-$arch.tar.gz+tar -czf "$tarball" -C "$root" Muxen+echo "Built $tarball ($(du -h "$tarball" | cut -f1))"diff --git a/scripts/package-windows.ps1 b/scripts/package-windows.ps1index be89e06..4649e31 100644--- a/scripts/package-windows.ps1+++ b/scripts/package-windows.ps1@@ -1,5 +1,5 @@-# Builds Muxen for Windows and packs it: dist\Muxen-Setup-x64.exe (an-# installer, with Inno Setup) and dist\Muxen-windows-x64.zip, both with+# Builds Muxen for Windows and packs it: dist\Muxen-<version>-windows-x64-setup.exe+# (an installer, with Inno Setup) and dist\Muxen-<version>-windows-x64.zip, both with# muxen.exe and, beside it in agents\, the agent builds it sets up on each# machine (made on a Mac or Linux by scripts/build-agents.sh).#@@ -8,6 +8,7 @@param([switch]$SkipBuild)$ErrorActionPreference = 'Stop'Set-Location (Split-Path $PSScriptRoot -Parent)+$version = (Select-String -Path Cargo.toml -Pattern '^version = "(.+)"' | Select-Object -First 1).Matches[0].Groups[1].Value# GPUI compiles its shaders with the Windows SDK's fxc.exe.if (-not $env:GPUI_FXC_PATH -and -not (Get-Command fxc.exe -ErrorAction SilentlyContinue)) {$fxc = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin" -Recurse -Filter fxc.exe -ErrorAction SilentlyContinue | Where-Object { $_.FullName -match '\\x64\\' } | Sort-Object FullName -Descending | Select-Object -First 1@@ -15,7 +16,7 @@ if (-not $env:GPUI_FXC_PATH -and -not (Get-Command fxc.exe -ErrorAction Silently$env:GPUI_FXC_PATH = $fxc.FullName}if (-not $SkipBuild) {- cargo build --release+ cargo build --release --lockedif ($LASTEXITCODE) { exit $LASTEXITCODE }}$agents = @(Get-ChildItem dist\agents -Filter 'muxen-agent-*' -ErrorAction SilentlyContinue)@@ -27,7 +28,7 @@ New-Item -ItemType Directory -Force (Join-Path $out 'agents') | Out-NullCopy-Item target\release\muxen.exe $out$agents | Copy-Item -Destination (Join-Path $out 'agents')Copy-Item README.md, LICENSE, THIRD_PARTY_NOTICES.md $out-$zip = 'dist\Muxen-windows-x64.zip'+$zip = "dist\Muxen-$version-windows-x64.zip"Compress-Archive -Path $out -DestinationPath $zip -Force"Built $zip ($([math]::Round((Get-Item $zip).Length / 1MB, 1)) MB)"@@ -35,10 +36,9 @@ Compress-Archive -Path $out -DestinationPath $zip -Force$iscc = @(Get-Command ISCC.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source) +@("$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe", "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe") | Where-Object { $_ -and (Test-Path $_) } | Select-Object -First 1if ($iscc) {- $version = (Select-String -Path Cargo.toml -Pattern '^version = "(.+)"' | Select-Object -First 1).Matches[0].Groups[1].Value- & $iscc /Q "/DAppVersion=$version" scripts\muxen.iss+ & $iscc /Q "/DAppVersion=$version" "/FMuxen-$version-windows-x64-setup" scripts\muxen.issif ($LASTEXITCODE) { exit $LASTEXITCODE }- $setup = 'dist\Muxen-Setup-x64.exe'+ $setup = "dist\Muxen-$version-windows-x64-setup.exe""Built $setup ($([math]::Round((Get-Item $setup).Length / 1MB, 1)) MB)"} else {'No Inno Setup here, so no installer (winget install JRSoftware.InnoSetup).'diff --git a/scripts/release.sh b/scripts/release.shnew file mode 100755index 0000000..fcda253--- /dev/null+++ b/scripts/release.sh@@ -0,0 +1,49 @@+#!/bin/sh+# Starts a release: sets the app's version in Cargo.toml (and Cargo.lock),+# commits that, and tags the commit v<version>. Pushing the tag starts the+# release workflow, which builds every platform into a draft GitHub release.+#+# scripts/release.sh 0.2.0 # commit and tag here; push yourself+# scripts/release.sh 0.2.0 --push # and push the branch and the tag+#+# See RELEASING.md.+set -eu++cd "$(dirname "$0")/.."+usage="usage: scripts/release.sh <version> [--push]"+version=${1:?$usage}+version=${version#v}+push=+case "${2:-}" in+ --push) push=1 ;;+ "") ;;+ *) echo "$usage" >&2; exit 2 ;;+esac++echo "$version" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$' \+ || { echo "error: \"$version\" isn't a version like 1.2.3" >&2; exit 2; }+[ -z "$(git status --porcelain)" ] || { echo "error: commit or stash your changes first" >&2; exit 1; }+if git rev-parse -q --verify "refs/tags/v$version" >/dev/null; then+ echo "error: v$version is already tagged" >&2+ exit 1+fi++current=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)+if [ "$current" != "$version" ]; then+ # The first `version =` is the package's own.+ awk -v v="$version" '!done && /^version = "/ { $0 = "version = \"" v "\""; done = 1 } { print }' Cargo.toml > Cargo.toml.new+ mv Cargo.toml.new Cargo.toml+ cargo update --workspace --quiet+ git add Cargo.toml Cargo.lock+ git commit --quiet -m "Muxen $version"+ echo "▸ version $current → $version"+fi+git tag -a "v$version" -m "Muxen $version"+echo "▸ tagged v$version on $(git rev-parse --short HEAD)"++if [ -n "$push" ]; then+ git push --quiet origin HEAD "v$version"+ echo "▸ pushed: the release workflow is building it (gh run watch, or Actions on GitHub)"+else+ echo "Push it to build the release: git push origin HEAD v$version"+fi