Skip to content

feat(ui): add click-to-enlarge Mermaid diagrams with zoom overlay and… #69

feat(ui): add click-to-enlarge Mermaid diagrams with zoom overlay and…

feat(ui): add click-to-enlarge Mermaid diagrams with zoom overlay and… #69

Workflow file for this run

name: Release SAM
on:
push:
tags:
- '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].*'
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g., 20251213.1)'
required: true
type: string
env:
XCODE_VERSION: '26.2'
MACOS_VERSION: '14.0'
permissions:
contents: write
jobs:
build-sign-notarize-package:
name: Build, Sign, Notarize, and Package
runs-on: [self-hosted]
outputs:
version: ${{ steps.version.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
clean: true
- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Download Metal Toolchain
run: |
echo "Downloading Metal Toolchain for Xcode ${{ env.XCODE_VERSION }}..."
sudo xcodebuild -downloadComponent MetalToolchain || echo "Metal Toolchain already installed or download failed"
- name: Extract version from tag
id: version
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
VERSION="$INPUT_VERSION"
else
VERSION=${GITHUB_REF#refs/tags/}
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Update version in Info.plist
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION" Info.plist
UPDATED_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" Info.plist)
if [ "$UPDATED_VERSION" != "$VERSION" ]; then
echo "ERROR: Version update failed"
exit 1
fi
- name: Build release package
run: make build-release
- name: Sign and notarize
run: |
if [ -f /Users/andrew/.sam_runner_env ]; then
source /Users/andrew/.sam_runner_env
fi
make sign-only-release
- name: Compute EdDSA signature
env:
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
# Find sign_update - present because the build just ran
SIGN_UPDATE=""
for candidate in \
".build/artifacts/sparkle/Sparkle/bin/sign_update" \
".build/SourcePackages/artifacts/sparkle/Sparkle/bin/sign_update" \
".build/checkouts/Sparkle/sign_update"; do
[ -f "$candidate" ] && SIGN_UPDATE="$candidate" && break
done
if [ -z "$SIGN_UPDATE" ]; then
echo "ERROR: sign_update binary not found"
exit 1
fi
TEMP_KEY_FILE=$(mktemp)
echo "$SPARKLE_PRIVATE_KEY" > "$TEMP_KEY_FILE"
chmod 600 "$TEMP_KEY_FILE"
# sign_update outputs: sparkle:edSignature="SIG" length="N"
SIG_OUTPUT=$("$SIGN_UPDATE" "dist/SAM-${VERSION}.zip" -f "$TEMP_KEY_FILE")
rm -f "$TEMP_KEY_FILE"
SIGNATURE=$(echo "$SIG_OUTPUT" | sed -n 's/.*sparkle:edSignature="\([^"]*\)".*/\1/p')
if [ -z "$SIGNATURE" ]; then
echo "ERROR: Failed to extract signature from: $SIG_OUTPUT"
exit 1
fi
echo "Signature: $SIGNATURE"
echo "$SIGNATURE" > "dist/SAM-${VERSION}.zip.sig"
- name: Verify distribution files
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
if [ ! -f "dist/SAM-${VERSION}.dmg" ]; then
echo "ERROR: DMG not found"
exit 1
fi
if [ ! -f "dist/SAM-${VERSION}.zip" ]; then
echo "ERROR: ZIP not found"
exit 1
fi
if [ ! -f "dist/SAM-${VERSION}.zip.sig" ]; then
echo "ERROR: Signature file not found"
exit 1
fi
echo "Distribution files ready:"
ls -lh dist/SAM-${VERSION}.*
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
# Write release notes to a temp file
NOTES_FILE=$(mktemp)
printf '%s\n' \
'## Downloads' \
'' \
"- **[SAM-${VERSION}.dmg](https://github.com/SyntheticAutonomicMind/SAM/releases/download/${VERSION}/SAM-${VERSION}.dmg)** - Recommended installer" \
"- **[SAM-${VERSION}.zip](https://github.com/SyntheticAutonomicMind/SAM/releases/download/${VERSION}/SAM-${VERSION}.zip)** - For Sparkle updates" \
'' \
'## Installation' \
'' \
'1. Download and open the DMG file' \
'2. Drag SAM.app to your Applications folder' \
'3. Launch SAM from Applications' \
> "$NOTES_FILE"
# Create release and upload assets using gh CLI (more reliable for large files)
gh release create "${VERSION}" \
--title "SAM ${VERSION}" \
--notes-file "$NOTES_FILE" \
--generate-notes \
"dist/SAM-${VERSION}.dmg" \
"dist/SAM-${VERSION}.zip" \
"dist/SAM-${VERSION}.zip.sig"
rm -f "$NOTES_FILE"