Skip to content

Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.

release: harden 2.9.8 publication

momenbasele31fa86a1eb2
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c9fa285..ded51a9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -19,6 +19,10 @@ on:
permissions:
contents: write
+concurrency:
+ group: puremac-release
+ cancel-in-progress: false
+
env:
APP_NAME: PureMac
BUNDLE_ID: com.puremac.app
@@ -39,32 +43,85 @@ jobs:
with:
fetch-depth: 0
- - name: Resolve version
+ - name: Resolve and validate release target
id: ver
+ env:
+ REQUESTED_VERSION: ${{ inputs.version }}
+ REQUESTED_DRY_RUN: ${{ inputs.dry_run }}
run: |
+ set -euo pipefail
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
- VERSION="${{ inputs.version }}"
+ VERSION="${REQUESTED_VERSION}"
else
VERSION="${GITHUB_REF_NAME#v}"
fi
- echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- echo "tag=v${VERSION}" >> "$GITHUB_OUTPUT"
- echo "Releasing version: ${VERSION}"
+
+ SEMVER_RE='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
+ if [[ ! "${VERSION}" =~ ${SEMVER_RE} ]]; then
+ echo "::error::Version must be strict SemVer core (for example, 2.9.8; no leading zeroes): ${VERSION}"
+ exit 1
+ fi
+
+ TAG="v${VERSION}"
+ BUILD_SHA="$(git rev-parse 'HEAD^{commit}')"
+
+ git fetch --no-tags origin main
+ if ! git merge-base --is-ancestor "${BUILD_SHA}" origin/main; then
+ echo "::error::Release commit ${BUILD_SHA} is not on origin/main."
+ exit 1
+ fi
+
+ if [[ "${{ github.event_name }}" == "push" ]]; then
+ if [[ "${GITHUB_REF}" != "refs/tags/${TAG}" || "${GITHUB_REF_NAME}" != "${TAG}" ]]; then
+ echo "::error::Tag trigger (${GITHUB_REF}) does not exactly match ${TAG}."
+ exit 1
+ fi
+ if ! TAG_SHA="$(git rev-parse "${TAG}^{commit}" 2>/dev/null)"; then
+ echo "::error::Release tag ${TAG} is not available in the checkout."
+ exit 1
+ fi
+ if [[ "${TAG_SHA}" != "${BUILD_SHA}" ]]; then
+ echo "::error::Release tag ${TAG} resolves to ${TAG_SHA}, but the build checkout is ${BUILD_SHA}."
+ exit 1
+ fi
+ elif [[ "${REQUESTED_DRY_RUN}" != "true" ]]; then
+ echo "::error::Manual dispatch is dry-run only. Publish by pushing the reviewed ${TAG} tag."
+ exit 1
+ fi
+
+ {
+ printf 'version=%s\n' "${VERSION}"
+ printf 'tag=%s\n' "${TAG}"
+ printf 'build_sha=%s\n' "${BUILD_SHA}"
+ } >> "${GITHUB_OUTPUT}"
+ echo "Releasing ${VERSION} from ${BUILD_SHA}"
- name: Verify version matches project.yml
run: |
- PROJ_VERSION=$(grep -E '^\s*MARKETING_VERSION:' project.yml | sed -E 's/.*"([^"]+)".*/\1/')
+ set -euo pipefail
+ PROJ_VERSION=$(sed -nE 's/^[[:space:]]*MARKETING_VERSION:[[:space:]]*"([^"]+)".*/\1/p' project.yml)
if [[ "${PROJ_VERSION}" != "${{ steps.ver.outputs.version }}" ]]; then
echo "::error::project.yml MARKETING_VERSION (${PROJ_VERSION}) != release version (${{ steps.ver.outputs.version }}). Bump project.yml first."
exit 1
fi
+ - name: Verify real-release publishing credentials
+ if: ${{ github.event_name == 'push' || inputs.dry_run == false }}
+ env:
+ HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
+ run: |
+ set -euo pipefail
+ if [[ -z "${HOMEBREW_TAP_DEPLOY_KEY:-}" ]]; then
+ echo "::error::HOMEBREW_TAP_DEPLOY_KEY is required for a real release."
+ exit 1
+ fi
+
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_16.4.app
- - name: Install xcodegen + create-dmg
+ - name: Install release tools
run: |
- brew install xcodegen create-dmg
+ brew install xcodegen create-dmg xcbeautify
- name: Generate Xcode project
run: xcodegen generate
@@ -84,7 +141,11 @@ jobs:
security unlock-keychain -p "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_PATH}"
security import "${CERT_PATH}" -P "${P12_PASSWORD}" -A -t cert -f pkcs12 -k "${KEYCHAIN_PATH}"
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_PATH}" >/dev/null
- security list-keychain -d user -s "${KEYCHAIN_PATH}" $(security list-keychain -d user | xargs)
+ CURRENT_KEYCHAINS=()
+ while IFS= read -r CURRENT_KEYCHAIN; do
+ CURRENT_KEYCHAINS+=("${CURRENT_KEYCHAIN}")
+ done < <(security list-keychain -d user | sed -E 's/^[[:space:]]*"//; s/"[[:space:]]*$//')
+ security list-keychain -d user -s "${KEYCHAIN_PATH}" "${CURRENT_KEYCHAINS[@]}"
# Verify identity loaded
security find-identity -v -p codesigning "${KEYCHAIN_PATH}" | grep "Developer ID Application: Moamen Basel"
@@ -132,11 +193,41 @@ jobs:
codesign --verify --deep --strict --verbose=2 "${APP}"
codesign -dvv "${APP}" 2>&1 | tee /tmp/cs-info.txt
grep -q "flags=0x10000(runtime)" /tmp/cs-info.txt || { echo "::error::Hardened runtime missing"; exit 1; }
- spctl --assess --type execute --verbose=4 "${APP}" || true
# Universal arch check
lipo -archs "${APP}/Contents/MacOS/PureMac" | grep -q "x86_64" && lipo -archs "${APP}/Contents/MacOS/PureMac" | grep -q "arm64"
- - name: Build DMG
+ - name: Write App Store Connect API key
+ env:
+ APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}
+ run: |
+ set -euo pipefail
+ KEY_PATH="${RUNNER_TEMP}/asc_api_key.p8"
+ printf '%s' "${APP_STORE_CONNECT_PRIVATE_KEY}" > "${KEY_PATH}"
+ chmod 600 "${KEY_PATH}"
+ echo "ASC_KEY_PATH=${KEY_PATH}" >> "$GITHUB_ENV"
+
+ - name: Notarize, staple, and validate app
+ env:
+ ASC_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
+ ASC_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
+ run: |
+ set -euo pipefail
+ APP="build/export/PureMac.app"
+ NOTARY_ZIP="build/PureMac-app-notary.zip"
+ ditto -c -k --keepParent --sequesterRsrc "${APP}" "${NOTARY_ZIP}"
+ xcrun notarytool submit "${NOTARY_ZIP}" \
+ --key "${ASC_KEY_PATH}" \
+ --key-id "${ASC_KEY_ID}" \
+ --issuer "${ASC_ISSUER_ID}" \
+ --wait \
+ --timeout 30m
+ xcrun stapler staple "${APP}"
+ xcrun stapler validate "${APP}"
+ codesign --verify --deep --strict --verbose=2 "${APP}"
+ spctl --assess --type execute --verbose=4 "${APP}"
+ rm -f "${NOTARY_ZIP}"
+
+ - name: Build DMG from stapled app
env:
VERSION: ${{ steps.ver.outputs.version }}
run: |
@@ -155,17 +246,7 @@ jobs:
codesign --sign "Developer ID Application: Moamen Basel (H3WXHVTP97)" --timestamp "${DMG}"
codesign --verify --verbose=2 "${DMG}"
- - name: Write App Store Connect API key
- env:
- APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}
- run: |
- set -euo pipefail
- KEY_PATH="${RUNNER_TEMP}/asc_api_key.p8"
- printf '%s' "${APP_STORE_CONNECT_PRIVATE_KEY}" > "${KEY_PATH}"
- chmod 600 "${KEY_PATH}"
- echo "ASC_KEY_PATH=${KEY_PATH}" >> "$GITHUB_ENV"
-
- - name: Notarize DMG
+ - name: Notarize, staple, and validate DMG
env:
ASC_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
@@ -183,23 +264,12 @@ jobs:
xcrun stapler validate "${DMG}"
spctl --assess --type install --verbose=4 "${DMG}"
- - name: Build notarized zip
+ - name: Build final ZIP from stapled app
env:
- ASC_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
- ASC_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
VERSION: ${{ steps.ver.outputs.version }}
run: |
set -euo pipefail
ZIP="build/PureMac-${VERSION}.zip"
- # Notarize the .app inside a zip too (homebrew cask uses zip)
- ditto -c -k --keepParent --sequesterRsrc build/export/PureMac.app build/PureMac-app.zip
- xcrun notarytool submit build/PureMac-app.zip \
- --key "${ASC_KEY_PATH}" \
- --key-id "${ASC_KEY_ID}" \
- --issuer "${ASC_ISSUER_ID}" \
- --wait --timeout 30m
- xcrun stapler staple build/export/PureMac.app
- # Final shippable zip with stapled ticket
ditto -c -k --keepParent --sequesterRsrc build/export/PureMac.app "${ZIP}"
- name: Compute SHA256 checksums
@@ -231,63 +301,230 @@ jobs:
build/CHECKSUMS.md
retention-days: 14
- - name: Create or update GitHub release
+ - name: Prepare and publish GitHub release
+ id: release
if: ${{ github.event_name == 'push' || inputs.dry_run == false }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.ver.outputs.version }}
TAG: ${{ steps.ver.outputs.tag }}
+ BUILD_SHA: ${{ steps.ver.outputs.build_sha }}
+ DMG_SHA: ${{ steps.sha.outputs.dmg }}
+ ZIP_SHA: ${{ steps.sha.outputs.zip }}
run: |
set -euo pipefail
NOTES_FILE=build/release-notes.md
- {
- echo "## PureMac ${VERSION}"
- echo ""
- echo "Universal binary (Intel + Apple Silicon). Signed with Developer ID + notarized + stapled by Apple."
- echo ""
- cat build/CHECKSUMS.md
- echo ""
- echo "### Install"
- echo ""
- echo "\`\`\`"
- echo "brew tap momenbasel/tap"
- echo "brew install --cask puremac"
- echo "\`\`\`"
- } > "${NOTES_FILE}"
-
- if gh release view "${TAG}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then
- gh release upload "${TAG}" \
- "build/PureMac-${VERSION}.dmg" \
- "build/PureMac-${VERSION}.zip" \
- --repo "${GITHUB_REPOSITORY}" --clobber
+ write_notes() {
+ local canonical_dmg_sha="$1" canonical_zip_sha="$2"
+ {
+ echo "## PureMac ${VERSION}"
+ echo ""
+ echo "Universal binary (Intel + Apple Silicon). Signed with Developer ID + notarized + stapled by Apple."
+ echo ""
+ if [[ "${VERSION}" == "2.9.8" ]]; then
+ echo "### What changed"
+ echo ""
+ echo "- Fixed switching Appearance from Dark back to System so the entire window updates immediately (#152)."
+ echo "- Fixed Smart Care progress-bar shimmer clipping and synchronization, including at low progress values, while preserving Reduce Motion (#153)."
+ echo "- Added Brazilian Portuguese documentation and synchronized its CLI setup section (#154)."
+ echo "- Corrected cleanup and security documentation to distinguish recoverable Trash operations from permanent and administrator-authorized cleanup paths."
+ echo "- Hardened release packaging so the DMG and Homebrew ZIP contain the Apple-stapled app, with serialized and retryable Homebrew publication."
+ echo ""
+ fi
+ echo "## Checksums"
+ echo ""
+ echo "| Asset | SHA-256 |"
+ echo "|-------|---------|"
+ echo "| PureMac-${VERSION}.dmg | \`${canonical_dmg_sha}\` |"
+ echo "| PureMac-${VERSION}.zip | \`${canonical_zip_sha}\` |"
+ echo ""
+ echo "### Install"
+ echo ""
+ echo "\`\`\`"
+ echo "brew tap momenbasel/tap"
+ echo "brew install --cask puremac"
+ echo "\`\`\`"
+ } > "${NOTES_FILE}"
+ }
+
+ validate_published_assets() {
+ local asset_dir="$1"
+ local published_dmg="${asset_dir}/PureMac-${VERSION}.dmg"
+ local published_zip="${asset_dir}/PureMac-${VERSION}.zip"
+ local expanded_dir="${asset_dir}/expanded"
+ hdiutil verify "${published_dmg}"
+ xcrun stapler validate "${published_dmg}"
+ spctl --assess --type install --verbose=4 "${published_dmg}"
+ mkdir -p "${expanded_dir}"
+ ditto -x -k "${published_zip}" "${expanded_dir}"
+ local published_app="${expanded_dir}/PureMac.app"
+ codesign --verify --deep --strict --verbose=4 "${published_app}"
+ xcrun stapler validate "${published_app}"
+ spctl --assess --type execute --verbose=4 "${published_app}"
+ codesign -dvv "${published_app}" 2>&1 | grep -Fq 'TeamIdentifier=H3WXHVTP97'
+ local app_archs app_version
+ app_archs=$(lipo -archs "${published_app}/Contents/MacOS/PureMac")
+ grep -qw arm64 <<< "${app_archs}"
+ grep -qw x86_64 <<< "${app_archs}"
+ app_version=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "${published_app}/Contents/Info.plist")
+ [[ "${app_version}" == "${VERSION}" ]]
+ }
+
+ # Re-fetch immediately before publication so a moved/deleted remote
+ # tag cannot mutate release assets before the mismatch is detected.
+ if ! git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
+ echo "::error::Remote release tag ${TAG} does not exist."
+ exit 1
+ fi
+ git fetch --force origin "refs/tags/${TAG}:refs/tags/${TAG}"
+ REMOTE_TAG_SHA=$(git rev-parse "${TAG}^{commit}")
+ if [[ "${REMOTE_TAG_SHA}" != "${BUILD_SHA}" ]]; then
+ echo "::error::Remote tag ${TAG} resolves to ${REMOTE_TAG_SHA}, not built commit ${BUILD_SHA}."
+ exit 1
+ fi
+
+ if RELEASE_JSON=$(gh release view "${TAG}" --repo "${GITHUB_REPOSITORY}" --json isDraft,isPrerelease 2>/dev/null); then
+ IS_DRAFT=$(jq -r '.isDraft' <<< "${RELEASE_JSON}")
+ IS_PRERELEASE=$(jq -r '.isPrerelease' <<< "${RELEASE_JSON}")
+ if [[ "${IS_PRERELEASE}" == "true" ]]; then
+ echo "::error::${TAG} is a prerelease; refusing to point the stable cask at it."
+ exit 1
+ fi
+
+ if [[ "${IS_DRAFT}" == "true" ]]; then
+ # Draft assets are not public, so a failed prior attempt can be
+ # repaired safely before the draft becomes the stable release.
+ gh release upload "${TAG}" \
+ "build/PureMac-${VERSION}.dmg" \
+ "build/PureMac-${VERSION}.zip" \
+ --repo "${GITHUB_REPOSITORY}" --clobber
+ CANONICAL_DMG_SHA="${DMG_SHA}"
+ CANONICAL_ZIP_SHA="${ZIP_SHA}"
+ write_notes "${CANONICAL_DMG_SHA}" "${CANONICAL_ZIP_SHA}"
+ gh release edit "${TAG}" \
+ --title "PureMac ${TAG}" \
+ --notes-file "${NOTES_FILE}" \
+ --draft=false \
+ --prerelease=false \
+ --repo "${GITHUB_REPOSITORY}"
+ else
+ # A published release is immutable in this workflow. Its signed,
+ # notarized assets become the source of truth for cask recovery.
+ VERIFY_DIR="${RUNNER_TEMP}/existing-release-${VERSION}"
+ mkdir -p "${VERIFY_DIR}"
+ gh release download "${TAG}" \
+ --pattern "PureMac-${VERSION}.dmg" \
+ --pattern "PureMac-${VERSION}.zip" \
+ --dir "${VERIFY_DIR}" \
+ --repo "${GITHUB_REPOSITORY}"
+ validate_published_assets "${VERIFY_DIR}"
+ CANONICAL_DMG_SHA=$(shasum -a 256 "${VERIFY_DIR}/PureMac-${VERSION}.dmg" | awk '{print $1}')
+ CANONICAL_ZIP_SHA=$(shasum -a 256 "${VERIFY_DIR}/PureMac-${VERSION}.zip" | awk '{print $1}')
+ write_notes "${CANONICAL_DMG_SHA}" "${CANONICAL_ZIP_SHA}"
+ gh release edit "${TAG}" \
+ --title "PureMac ${TAG}" \
+ --notes-file "${NOTES_FILE}" \
+ --repo "${GITHUB_REPOSITORY}"
+ fi
else
+ CANONICAL_DMG_SHA="${DMG_SHA}"
+ CANONICAL_ZIP_SHA="${ZIP_SHA}"
+ write_notes "${CANONICAL_DMG_SHA}" "${CANONICAL_ZIP_SHA}"
gh release create "${TAG}" \
"build/PureMac-${VERSION}.dmg" \
"build/PureMac-${VERSION}.zip" \
+ --verify-tag \
+ --draft \
--title "PureMac ${TAG}" \
--notes-file "${NOTES_FILE}" \
--repo "${GITHUB_REPOSITORY}"
+ gh release edit "${TAG}" \
+ --draft=false \
+ --prerelease=false \
+ --repo "${GITHUB_REPOSITORY}"
+ fi
+
+ RELEASE_SHA=$(gh api "repos/${GITHUB_REPOSITORY}/commits/${TAG}" --jq .sha)
+ if [[ "${RELEASE_SHA}" != "${BUILD_SHA}" ]]; then
+ echo "::error::Published tag ${TAG} resolves to ${RELEASE_SHA}, not built commit ${BUILD_SHA}."
+ exit 1
+ fi
+ RELEASE_STATE=$(gh release view "${TAG}" --repo "${GITHUB_REPOSITORY}" --json isDraft,isPrerelease)
+ if [[ "$(jq -r '.isDraft' <<< "${RELEASE_STATE}")" != "false" || "$(jq -r '.isPrerelease' <<< "${RELEASE_STATE}")" != "false" ]]; then
+ echo "::error::${TAG} is not a published stable release."
+ exit 1
fi
+ {
+ printf 'dmg_sha=%s\n' "${CANONICAL_DMG_SHA}"
+ printf 'zip_sha=%s\n' "${CANONICAL_ZIP_SHA}"
+ } >> "${GITHUB_OUTPUT}"
- name: Bump in-repo homebrew formula
if: ${{ github.event_name == 'push' || inputs.dry_run == false }}
env:
VERSION: ${{ steps.ver.outputs.version }}
- ZIP_SHA: ${{ steps.sha.outputs.zip }}
+ ZIP_SHA: ${{ steps.release.outputs.zip_sha }}
run: |
set -euo pipefail
+ SEMVER_RE='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
+ version_is_older() {
+ local candidate_major candidate_minor candidate_patch current_major current_minor current_patch
+ IFS=. read -r candidate_major candidate_minor candidate_patch <<< "$1"
+ IFS=. read -r current_major current_minor current_patch <<< "$2"
+ (( 10#${candidate_major} < 10#${current_major} )) && return 0
+ (( 10#${candidate_major} > 10#${current_major} )) && return 1
+ (( 10#${candidate_minor} < 10#${current_minor} )) && return 0
+ (( 10#${candidate_minor} > 10#${current_minor} )) && return 1
+ (( 10#${candidate_patch} < 10#${current_patch} ))
+ }
+ validate_formula_state() {
+ local current_version="$1" current_sha="$2"
+ if [[ ! "${current_version}" =~ ${SEMVER_RE} ]]; then
+ echo "::error::Existing Homebrew version is not strict SemVer: ${current_version}"
+ exit 1
+ fi
+ if version_is_older "${VERSION}" "${current_version}"; then
+ echo "::error::Refusing to downgrade Homebrew from ${current_version} to ${VERSION}."
+ exit 1
+ fi
+ if [[ "${VERSION}" == "${current_version}" && "${ZIP_SHA}" != "${current_sha}" ]]; then
+ echo "::error::Homebrew already has ${VERSION} with a different SHA; refusing replacement."
+ exit 1
+ fi
+ }
FORMULA=homebrew/puremac.rb
- /usr/bin/sed -i '' -E "s/^ version \".*\"/ version \"${VERSION}\"/" "${FORMULA}"
- /usr/bin/sed -i '' -E "s/^ sha256 \".*\"/ sha256 \"${ZIP_SHA}\"/" "${FORMULA}"
- git config user.name "github-actions[bot]"
- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- git add "${FORMULA}"
- if git diff --cached --quiet; then
- echo "No formula changes to commit."
- else
- git commit -m "homebrew: bump to ${VERSION} (sha256 ${ZIP_SHA:0:12})"
- git push origin HEAD:main
- fi
+ for attempt in 1 2 3; do
+ git fetch origin main
+ REMOTE_VERSION=$(git show "origin/main:${FORMULA}" | sed -nE 's/^ version "([^"]+)"/\1/p')
+ REMOTE_SHA=$(git show "origin/main:${FORMULA}" | sed -nE 's/^ sha256 "([^"]+)"/\1/p')
+ validate_formula_state "${REMOTE_VERSION}" "${REMOTE_SHA}"
+ if [[ "${REMOTE_VERSION}" == "${VERSION}" && "${REMOTE_SHA}" == "${ZIP_SHA}" ]]; then
+ echo "The in-repo Homebrew cask is already at ${VERSION} with the expected SHA."
+ exit 0
+ fi
+
+ FORMULA_WORKTREE="${RUNNER_TEMP}/puremac-formula-${attempt}"
+ git worktree add --detach "${FORMULA_WORKTREE}" origin/main
+ FORMULA_PATH="${FORMULA_WORKTREE}/${FORMULA}"
+ /usr/bin/sed -i '' -E "s/^ version \".*\"/ version \"${VERSION}\"/" "${FORMULA_PATH}"
+ /usr/bin/sed -i '' -E "s/^ sha256 \".*\"/ sha256 \"${ZIP_SHA}\"/" "${FORMULA_PATH}"
+ grep -Fqx " version \"${VERSION}\"" "${FORMULA_PATH}"
+ grep -Fqx " sha256 \"${ZIP_SHA}\"" "${FORMULA_PATH}"
+ git -C "${FORMULA_WORKTREE}" config user.name "github-actions[bot]"
+ git -C "${FORMULA_WORKTREE}" config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git -C "${FORMULA_WORKTREE}" add "${FORMULA}"
+ git -C "${FORMULA_WORKTREE}" commit -m "homebrew: bump to ${VERSION} (sha256 ${ZIP_SHA:0:12})"
+ if git -C "${FORMULA_WORKTREE}" push origin HEAD:main; then
+ git worktree remove "${FORMULA_WORKTREE}"
+ break
+ fi
+ git worktree remove --force "${FORMULA_WORKTREE}"
+ if [[ "${attempt}" -eq 3 ]]; then
+ echo "::error::Could not push the in-repo Homebrew update after ${attempt} attempts."
+ exit 1
+ fi
+ echo "main moved; recreating the formula update before retry $((attempt + 1))/3."
+ done
- name: Bump tap formula (momenbasel/homebrew-tap)
# Auth is a write deploy key scoped to the tap repo only — least
@@ -297,12 +534,38 @@ jobs:
env:
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
VERSION: ${{ steps.ver.outputs.version }}
- ZIP_SHA: ${{ steps.sha.outputs.zip }}
+ ZIP_SHA: ${{ steps.release.outputs.zip_sha }}
run: |
set -euo pipefail
+ SEMVER_RE='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
+ version_is_older() {
+ local candidate_major candidate_minor candidate_patch current_major current_minor current_patch
+ IFS=. read -r candidate_major candidate_minor candidate_patch <<< "$1"
+ IFS=. read -r current_major current_minor current_patch <<< "$2"
+ (( 10#${candidate_major} < 10#${current_major} )) && return 0
+ (( 10#${candidate_major} > 10#${current_major} )) && return 1
+ (( 10#${candidate_minor} < 10#${current_minor} )) && return 0
+ (( 10#${candidate_minor} > 10#${current_minor} )) && return 1
+ (( 10#${candidate_patch} < 10#${current_patch} ))
+ }
+ validate_formula_state() {
+ local current_version="$1" current_sha="$2"
+ if [[ ! "${current_version}" =~ ${SEMVER_RE} ]]; then
+ echo "::error::Existing tap version is not strict SemVer: ${current_version}"
+ exit 1
+ fi
+ if version_is_older "${VERSION}" "${current_version}"; then
+ echo "::error::Refusing to downgrade the tap from ${current_version} to ${VERSION}."
+ exit 1
+ fi
+ if [[ "${VERSION}" == "${current_version}" && "${ZIP_SHA}" != "${current_sha}" ]]; then
+ echo "::error::The tap already has ${VERSION} with a different SHA; refusing replacement."
+ exit 1
+ fi
+ }
if [[ -z "${HOMEBREW_TAP_DEPLOY_KEY:-}" ]]; then
- echo "::warning title=Tap bump skipped::HOMEBREW_TAP_DEPLOY_KEY secret is not set. Tap will stay at its previous version. Set the secret to enable auto-bumps."
- exit 0
+ echo "::error::HOMEBREW_TAP_DEPLOY_KEY is required for a real release."
+ exit 1
fi
KEY_FILE="${RUNNER_TEMP}/tap_deploy_key"
printf '%s\n' "${HOMEBREW_TAP_DEPLOY_KEY}" > "${KEY_FILE}"
@@ -310,26 +573,40 @@ jobs:
KNOWN_HOSTS="${RUNNER_TEMP}/tap_known_hosts"
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" > "${KNOWN_HOSTS}"
export GIT_SSH_COMMAND="ssh -i ${KEY_FILE} -o IdentitiesOnly=yes -o UserKnownHostsFile=${KNOWN_HOSTS} -o StrictHostKeyChecking=yes"
- TAP_DIR="${RUNNER_TEMP}/homebrew-tap"
- git clone [email protected]:momenbasel/homebrew-tap.git "${TAP_DIR}"
- cd "${TAP_DIR}"
- # Cask path may be Casks/puremac.rb or puremac.rb depending on tap layout
- FORMULA=$(find . -name 'puremac.rb' -not -path './.git/*' | head -1)
- if [[ -z "${FORMULA}" ]]; then
- echo "::error::puremac.rb not found in tap"
- exit 1
- fi
- /usr/bin/sed -i '' -E "s/^ version \".*\"/ version \"${VERSION}\"/" "${FORMULA}"
- /usr/bin/sed -i '' -E "s/^ sha256 \".*\"/ sha256 \"${ZIP_SHA}\"/" "${FORMULA}"
- git config user.name "github-actions[bot]"
- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- git add "${FORMULA}"
- if git diff --cached --quiet; then
- echo "No tap formula changes."
- else
- git commit -m "puremac: bump to ${VERSION} (sha256 ${ZIP_SHA:0:12})"
- git push origin HEAD
- fi
+ FORMULA=Casks/puremac.rb
+ for attempt in 1 2 3; do
+ TAP_DIR="${RUNNER_TEMP}/homebrew-tap-${attempt}"
+ git clone --depth 1 --branch main [email protected]:momenbasel/homebrew-tap.git "${TAP_DIR}"
+ FORMULA_PATH="${TAP_DIR}/${FORMULA}"
+ if [[ ! -f "${FORMULA_PATH}" ]]; then
+ echo "::error::${FORMULA} not found in tap"
+ exit 1
+ fi
+ CURRENT_VERSION=$(sed -nE 's/^ version "([^"]+)"/\1/p' "${FORMULA_PATH}")
+ CURRENT_SHA=$(sed -nE 's/^ sha256 "([^"]+)"/\1/p' "${FORMULA_PATH}")
+ validate_formula_state "${CURRENT_VERSION}" "${CURRENT_SHA}"
+ if [[ "${CURRENT_VERSION}" == "${VERSION}" && "${CURRENT_SHA}" == "${ZIP_SHA}" ]]; then
+ echo "The external tap is already at ${VERSION} with the expected SHA."
+ exit 0
+ fi
+
+ /usr/bin/sed -i '' -E "s/^ version \".*\"/ version \"${VERSION}\"/" "${FORMULA_PATH}"
+ /usr/bin/sed -i '' -E "s/^ sha256 \".*\"/ sha256 \"${ZIP_SHA}\"/" "${FORMULA_PATH}"
+ grep -Fqx " version \"${VERSION}\"" "${FORMULA_PATH}"
+ grep -Fqx " sha256 \"${ZIP_SHA}\"" "${FORMULA_PATH}"
+ git -C "${TAP_DIR}" config user.name "github-actions[bot]"
+ git -C "${TAP_DIR}" config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git -C "${TAP_DIR}" add "${FORMULA}"
+ git -C "${TAP_DIR}" commit -m "puremac: bump to ${VERSION} (sha256 ${ZIP_SHA:0:12})"
+ if git -C "${TAP_DIR}" push origin HEAD:main; then
+ break
+ fi
+ if [[ "${attempt}" -eq 3 ]]; then
+ echo "::error::Could not push the tap update after ${attempt} attempts."
+ exit 1
+ fi
+ echo "Tap main moved; recreating the update before retry $((attempt + 1))/3."
+ done
- name: Cleanup keychain + ASC key + tap deploy key
if: always()
diff --git a/PureMac.xcodeproj/project.pbxproj b/PureMac.xcodeproj/project.pbxproj
index 8ae097b..fbde2a1 100644
--- a/PureMac.xcodeproj/project.pbxproj
+++ b/PureMac.xcodeproj/project.pbxproj
@@ -637,7 +637,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 27;
+ CURRENT_PROJECT_VERSION = 28;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = H3WXHVTP97;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -659,7 +659,7 @@
GENERATE_INFOPLIST_FILE = NO;
INFOPLIST_FILE = PureMac/Info.plist;
MACOSX_DEPLOYMENT_TARGET = 13.0;
- MARKETING_VERSION = 2.9.7;
+ MARKETING_VERSION = 2.9.8;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = NO;
@@ -761,7 +761,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 27;
+ CURRENT_PROJECT_VERSION = 28;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = H3WXHVTP97;
ENABLE_NS_ASSERTIONS = NO;
@@ -777,7 +777,7 @@
GENERATE_INFOPLIST_FILE = NO;
INFOPLIST_FILE = PureMac/Info.plist;
MACOSX_DEPLOYMENT_TARGET = 13.0;
- MARKETING_VERSION = 2.9.7;
+ MARKETING_VERSION = 2.9.8;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = NO;
diff --git a/README.md b/README.md
index 5dd0137..3cd40ea 100644
--- a/README.md
+++ b/README.md
@@ -71,9 +71,9 @@ open build/Build/Products/Release/PureMac.app
### Command line (beta)
-Prefer the terminal? `puremac` is a CLI companion that reuses the same cleaning
-logic and safety rules to clear developer caches, purge project build artifacts,
-and analyze disk usage.
+Prefer the terminal? `puremac` is an independent CLI companion with its own
+cleanup commands and safety checks. Some commands permanently remove selected
+files, so start with `--dry-run`, review every path, and then confirm deliberately.
```bash
brew install momenbasel/tap/puremac-cli
@@ -95,7 +95,7 @@ See [`cli/README.md`](cli/README.md) for the full command reference.
| No subscription | **Yes** | No | Yes | — | Yes |
| Signed + notarized | **Yes** | Yes | Yes | — | Yes |
| App uninstaller + orphans | **Yes** | Yes | Yes | Partial | No |
-| Trash-only (recoverable) | **Yes** | Partial | Yes | Partial | No |
+| App-uninstall Trash support | **Yes** | Partial | Yes | Partial | No |
| Honest about purgeable space | **Yes** | No | n/a | n/a | n/a |
<sub>¹ Pearcleaner is Apache 2.0 **+ Commons Clause** - source-available but not OSI-approved (you may not sell it). PureMac is true MIT. Comparison reflects publicly documented features as of 2026; corrections welcome via PR.</sub>
@@ -104,11 +104,11 @@ See [`cli/README.md`](cli/README.md) for the full command reference.
A Mac cleaner asks for the deepest permission macOS grants - Full Disk Access - and then deletes your files. That demands a level of trust the category has spent twenty years burning. Here's the contract PureMac holds itself to, and you can verify every line of it in the source:
-- **Trash, never `rm`.** Everything PureMac removes goes to the Trash via `FileManager.trashItem`. If it was wrong, you drag it back. Nothing is shredded or unlinked.
+- **Deletion behavior is explicit.** App-uninstaller flows attempt to move selected app files to the Trash. Dashboard/category cleanup, scheduled auto-clean, orphan removal, Trash emptying, Docker/Xcode runtime cleanup, administrator-authorized cleanup, and CLI cleanup can permanently delete data. Review selections carefully and use CLI dry runs.
- **No telemetry, ever.** No analytics, no crash reporting, no "anonymous usage stats," no network calls to us. The app doesn't know you exist.
- **No fake urgency.** No dramatized "47 GB of junk detected!" badge, no red alarm counters, no "your Mac is at risk." We show you neutral facts and let you decide.
- **No overpromising.** We don't claim to "reclaim purgeable space," "boost RAM," or "speed up your Mac" - things no app can reliably do. See the purgeable-space note below.
-- **You review before anything is removed.** Nothing is auto-deleted. Every item shows its real path with Reveal-in-Finder, and high-risk system paths are hard-excluded in code.
+- **Reviewable selection.** Dashboard/category cleanup and single-file app removal prompt before acting. Bulk app-file and orphan removal act on the explicit selection without another prompt. Scheduled auto-clean is unattended once enabled, and tool-backed rows such as Docker cleanup may not have a revealable path.
- **Auditable.** It's MIT. The exact code that decides what gets removed is in [`PureMac/Services`](PureMac/Services) and [`PureMac/Logic/Scanning`](PureMac/Logic/Scanning). Read it. Fork it. Ship your own.
If PureMac ever adds telemetry, a paywall on core features, or a fear-based scan, it will have become the thing it was built to replace. Hold us to this.
@@ -161,21 +161,18 @@ The first-launch onboarding walks you through granting it with an animated previ
What PureMac does *not* do:
- It does not collect telemetry, crash reports, or usage analytics.
- It does not require a network connection to operate.
-- It does not move data anywhere except the Trash.
+- It does not upload or transmit scanned paths or deleted data.
## Troubleshooting
### Launchpad / Dock shows a stale or dull PureMac icon
-macOS aggressively caches app icons in LaunchServices. After a Homebrew **reinstall or upgrade** the Dock and Launchpad can keep showing the old cached icon. PureMac's cask now runs `lsregister -f` on install to refresh it automatically, but if a stale icon persists, reset the cache manually:
+macOS aggressively caches app icons in LaunchServices. After a Homebrew **reinstall or upgrade** the Dock and Launchpad can keep showing the old cached icon. PureMac's cask runs `lsregister -f` on install to refresh it automatically. If a stale icon persists, re-register only PureMac and restart the Dock (adjust the app path if you installed it elsewhere):
```bash
-# Clear the icon caches and rebuild the LaunchServices database
-sudo rm -rfv /Library/Caches/com.apple.iconservices.store
-sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; 2>/dev/null
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister \
- -kill -r -domain local -domain user -domain system
-killall Dock; killall Finder
+ -f "/Applications/PureMac.app"
+killall Dock
```
Give it a minute to re-seed, then open PureMac once. If it still sticks, a restart (or Safe Mode boot) forces a full rebuild.
@@ -224,11 +221,11 @@ Key components:
## Security
-- Symlink attack prevention: paths are resolved before validation, re-resolved immediately before unlink to close TOCTOU windows.
-- Allow-list cleaning: a path that doesn't sit inside an explicit safe-root is refused, even for the user-level pass.
-- Admin escalation is gated by a *narrower* allow-list (app bundles, package receipts, launch plists) than the normal cleaner — root-owned items can only be removed inside those roots.
+- Core-cleaner symlink-risk reduction: `CleaningEngine` resolves paths before validation and again near user-level deletion. Because final removal remains path-based, this narrows but cannot eliminate every TOCTOU race; other removal workflows have separate checks.
+- Core-cleaner allow-list: `CleaningEngine` refuses a user-level path outside its explicit safe roots. App-uninstaller and orphan flows use their own policies.
+- Admin escalation is gated by its own explicit allow-list; root-owned items outside those permitted roots are refused.
- System app protection: Apple's bundles cannot be uninstalled, regardless of selection.
-- All destructive operations require explicit confirmation by default. The toggle that disables that confirmation is buried in Settings.
+- Confirmation varies by workflow: dashboard/category cleanup and single-file app removal prompt; bulk app-file and orphan removal act on the explicit selection without another prompt; scheduled auto-clean is unattended after enablement.
If you find a vulnerability, please open a private security advisory rather than a public issue.
diff --git a/docs/README.pt-BR.md b/docs/README.pt-BR.md
index 82d07f4..14906c3 100644
--- a/docs/README.pt-BR.md
+++ b/docs/README.pt-BR.md
@@ -71,10 +71,10 @@ open build/Build/Products/Release/PureMac.app
### Linha de comando (beta)
-Prefere o terminal? O `puremac` é um companheiro de linha de comando que
-reutiliza as mesmas regras de limpeza e segurança para remover caches de
-desenvolvimento, limpar artefatos de build de projetos e analisar o uso do
-disco.
+Prefere o terminal? O `puremac` é um companheiro de linha de comando
+independente, com comandos de limpeza e verificações de segurança próprios.
+Alguns comandos removem permanentemente os arquivos selecionados; comece com
+`--dry-run`, revise cada caminho e só então confirme deliberadamente.
```bash
brew install momenbasel/tap/puremac-cli
@@ -96,7 +96,7 @@ Consulte [`cli/README.md`](../cli/README.md) para ver a referência completa de
| Sem assinatura | **Sim** | Não | Sim | — | Sim |
| Assinado + notarizado | **Sim** | Sim | Sim | — | Sim |
| Desinstalador de apps + órfãos | **Sim** | Sim | Sim | Parcial | Não |
-| Só Lixeira (recuperável) | **Sim** | Parcial | Sim | Parcial | Não |
+| Lixeira no desinstalador de apps | **Sim** | Parcial | Sim | Parcial | Não |
| Honesto sobre espaço purgável | **Sim** | Não | n/a | n/a | n/a |
<sub>¹ O Pearcleaner é Apache 2.0 **+ Commons Clause** - código-disponível, mas não aprovado pela OSI (você não pode vendê-lo). O PureMac é MIT de verdade. O comparativo reflete recursos documentados publicamente em 2026; correções são bem-vindas via PR.</sub>
@@ -105,11 +105,11 @@ Consulte [`cli/README.md`](../cli/README.md) para ver a referência completa de
Um limpador de Mac pede a permissão mais profunda que o macOS concede - o Acesso Total ao Disco - e depois apaga os seus arquivos. Isso exige um nível de confiança que a categoria passou vinte anos queimando. Este é o contrato que o PureMac assume consigo mesmo, e você pode verificar cada linha dele no código-fonte:
-- **Lixeira, nunca `rm`.** Tudo o que o PureMac remove vai para a Lixeira via `FileManager.trashItem`. Se foi um engano, basta arrastar de volta. Nada é destruído ou desvinculado.
+- **O comportamento de remoção é explícito.** Os fluxos do desinstalador tentam mover os arquivos de apps selecionados para a Lixeira. A limpeza do painel/das categorias, a limpeza automática agendada, a remoção de órfãos, o esvaziamento da Lixeira, a limpeza do Docker/de runtimes do Xcode, a limpeza autorizada como administrador e a CLI podem apagar dados permanentemente. Revise as seleções e use o modo de simulação da CLI.
- **Sem telemetria, nunca.** Sem analytics, sem relatórios de falha, sem "estatísticas anônimas de uso", sem chamadas de rede para nós. O app não sabe que você existe.
- **Sem urgência fabricada.** Nenhum selo dramático de "47 GB de lixo detectados!", nenhum contador vermelho de alarme, nenhum "seu Mac está em risco". Mostramos fatos neutros e deixamos você decidir.
- **Sem promessas exageradas.** Não afirmamos "recuperar espaço purgável", "turbinar a RAM" nem "acelerar o seu Mac" - coisas que nenhum app consegue fazer de forma confiável. Veja a nota sobre espaço purgável abaixo.
-- **Você revisa antes de qualquer remoção.** Nada é apagado automaticamente. Cada item mostra o caminho real com Revelar no Finder, e caminhos de sistema de alto risco são excluídos de forma fixa no código.
+- **Seleção revisável.** A limpeza do painel/das categorias e a remoção de um único arquivo de app pedem confirmação. A remoção em lote de arquivos de apps e de órfãos age sobre a seleção explícita sem uma segunda confirmação. A limpeza automática agendada é executada sem interação depois de ativada, e linhas baseadas em ferramentas, como a limpeza do Docker, podem não ter um caminho revelável.
- **Auditável.** É MIT. O código exato que decide o que é removido está em [`PureMac/Services`](../PureMac/Services) e [`PureMac/Logic/Scanning`](../PureMac/Logic/Scanning). Leia. Faça um fork. Publique o seu próprio.
Se algum dia o PureMac adicionar telemetria, um paywall sobre recursos essenciais ou um escaneamento baseado em medo, ele terá se tornado exatamente aquilo que foi criado para substituir. Cobre isso de nós.
@@ -162,21 +162,18 @@ O onboarding do primeiro uso guia a concessão da permissão com uma prévia ani
O que o PureMac *não* faz:
- Não coleta telemetria, relatórios de falha nem análises de uso.
- Não exige conexão de rede para funcionar.
-- Não move dados para lugar nenhum além da Lixeira.
+- Não envia nem transmite caminhos escaneados ou dados removidos.
## Solução de problemas
### O Launchpad / Dock mostra um ícone desatualizado ou sem cor do PureMac
-O macOS faz cache agressivo de ícones de apps no LaunchServices. Após uma **reinstalação ou atualização** via Homebrew, o Dock e o Launchpad podem continuar exibindo o ícone antigo em cache. O cask do PureMac agora executa `lsregister -f` na instalação para atualizá-lo automaticamente, mas se um ícone desatualizado persistir, redefina o cache manualmente:
+O macOS faz cache agressivo de ícones de apps no LaunchServices. Após uma **reinstalação ou atualização** via Homebrew, o Dock e o Launchpad podem continuar exibindo o ícone antigo em cache. O cask do PureMac executa `lsregister -f` na instalação para atualizá-lo automaticamente. Se o ícone desatualizado persistir, registre novamente apenas o PureMac e reinicie o Dock (ajuste o caminho se você instalou o app em outro local):
```bash
-# Limpa os caches de ícones e reconstrói o banco de dados do LaunchServices
-sudo rm -rfv /Library/Caches/com.apple.iconservices.store
-sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; 2>/dev/null
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister \
- -kill -r -domain local -domain user -domain system
-killall Dock; killall Finder
+ -f "/Applications/PureMac.app"
+killall Dock
```
Dê um minuto para o cache se repovoar e abra o PureMac uma vez. Se ainda persistir, uma reinicialização (ou boot em Modo de Segurança) força a reconstrução completa.
@@ -225,11 +222,11 @@ Componentes-chave:
## Segurança
-- Prevenção de ataques por symlink: os caminhos são resolvidos antes da validação e re-resolvidos imediatamente antes do unlink para fechar janelas de TOCTOU.
-- Limpeza por allow-list: um caminho que não esteja dentro de uma raiz segura explícita é recusado, mesmo na passagem em nível de usuário.
-- O escalonamento de admin é limitado por uma allow-list *mais estreita* (bundles de apps, recibos de pacotes, plists de launch) do que a do limpador normal — itens do root só podem ser removidos dentro dessas raízes.
+- Redução do risco de symlinks no limpador principal: o `CleaningEngine` resolve os caminhos antes da validação e novamente perto da remoção em nível de usuário. Como a remoção final ainda usa o caminho, isso reduz, mas não elimina, todas as condições de corrida TOCTOU; os outros fluxos de remoção têm verificações próprias.
+- Allow-list do limpador principal: o `CleaningEngine` recusa, na passagem em nível de usuário, caminhos fora das raízes seguras explícitas. O desinstalador de apps e o fluxo de órfãos usam políticas próprias.
+- O escalonamento de administrador usa sua própria allow-list explícita; itens do root fora das raízes permitidas são recusados.
- Proteção de apps do sistema: os bundles da Apple não podem ser desinstalados, independentemente da seleção.
-- Toda operação destrutiva exige confirmação explícita por padrão. O interruptor que desativa essa confirmação fica escondido nos Ajustes.
+- A confirmação varia conforme o fluxo: a limpeza do painel/das categorias e a remoção de um único arquivo de app pedem confirmação; a remoção em lote de arquivos de apps e de órfãos age sobre a seleção explícita sem uma segunda confirmação; a limpeza automática agendada é executada sem confirmação a cada rodada depois de ativada.
Se você encontrar uma vulnerabilidade, abra um aviso de segurança privado (security advisory) em vez de uma issue pública.
diff --git a/project.yml b/project.yml
index 2d25377..8aff5ff 100644
--- a/project.yml
+++ b/project.yml
@@ -23,8 +23,8 @@ settings:
CODE_SIGN_ENTITLEMENTS: "PureMac/PureMac.entitlements"
INFOPLIST_FILE: "PureMac/Info.plist"
PRODUCT_BUNDLE_IDENTIFIER: "com.puremac.app"
- MARKETING_VERSION: "2.9.7"
- CURRENT_PROJECT_VERSION: "27"
+ MARKETING_VERSION: "2.9.8"
+ CURRENT_PROJECT_VERSION: "28"
GENERATE_INFOPLIST_FILE: "NO"
ASSETCATALOG_COMPILER_APPICON_NAME: "AppIcon"
COMBINE_HIDPI_IMAGES: "YES"
diff --git a/scripts/release-local.sh b/scripts/release-local.sh
index 8be8eb4..599a1af 100755
--- a/scripts/release-local.sh
+++ b/scripts/release-local.sh
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
#
-# Local mirror of .github/workflows/release.yml. Use for emergency hotfixes
-# when CI is unavailable. Requires:
+# Local mirror of .github/workflows/release.yml for producing and validating
+# release artifacts. The tag-triggered CI workflow remains the canonical
+# publisher. Requires:
# - Developer ID Application identity in your login keychain
# - notarytool keychain profile already stored, e.g.:
# xcrun notarytool store-credentials AC_NOTARY \
@@ -27,7 +28,47 @@ ZIP="build/PureMac-${VERSION}.zip"
cd "$(dirname "$0")/.."
-PROJ_VERSION=$(grep -E '^\s*MARKETING_VERSION:' project.yml | sed -E 's/.*"([^"]+)".*/\1/')
+SEMVER_RE='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
+if [[ ! "${VERSION}" =~ ${SEMVER_RE} ]]; then
+ echo "ERROR: version must be strict SemVer core (for example, 2.9.8; no leading zeroes): ${VERSION}" >&2
+ exit 1
+fi
+
+BUILD_SHA=$(git rev-parse 'HEAD^{commit}')
+TAG="v${VERSION}"
+if ! git diff --quiet || ! git diff --cached --quiet; then
+ echo "ERROR: tracked release inputs must be committed before building artifacts" >&2
+ exit 1
+fi
+UNTRACKED_INPUTS=$(git ls-files --others --exclude-standard -- PureMac project.yml PureMac.xcodeproj)
+if [[ -n "${UNTRACKED_INPUTS}" ]]; then
+ echo "ERROR: untracked release inputs must be committed before building artifacts:" >&2
+ printf '%s\n' "${UNTRACKED_INPUTS}" >&2
+ exit 1
+fi
+
+git fetch --no-tags origin main
+REMOTE_MAIN_SHA=$(git rev-parse 'origin/main^{commit}')
+if [[ "${BUILD_SHA}" != "${REMOTE_MAIN_SHA}" ]]; then
+ echo "ERROR: current commit ${BUILD_SHA} is not the latest origin/main commit ${REMOTE_MAIN_SHA}" >&2
+ exit 1
+fi
+
+if LOCAL_TAG_SHA=$(git rev-parse "${TAG}^{commit}" 2>/dev/null) && [[ "${LOCAL_TAG_SHA}" != "${BUILD_SHA}" ]]; then
+ echo "ERROR: local tag ${TAG} resolves to ${LOCAL_TAG_SHA}, not current commit ${BUILD_SHA}" >&2
+ exit 1
+fi
+
+if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
+ git fetch --force origin "refs/tags/${TAG}:refs/tags/${TAG}"
+ TAG_SHA=$(git rev-parse "${TAG}^{commit}")
+ if [[ "${TAG_SHA}" != "${BUILD_SHA}" ]]; then
+ echo "ERROR: remote tag ${TAG} resolves to ${TAG_SHA}, not current commit ${BUILD_SHA}" >&2
+ exit 1
+ fi
+fi
+
+PROJ_VERSION=$(sed -nE 's/^[[:space:]]*MARKETING_VERSION:[[:space:]]*"([^"]+)".*/\1/p' project.yml)
if [[ "${PROJ_VERSION}" != "${VERSION}" ]]; then
echo "ERROR: project.yml MARKETING_VERSION (${PROJ_VERSION}) != ${VERSION}" >&2
exit 1
@@ -77,9 +118,24 @@ echo "==> verify codesign"
codesign --verify --deep --strict --verbose=2 "${APP}"
codesign -dvv "${APP}" 2>&1 | grep -E "Identifier|TeamIdentifier|flags|Authority"
codesign -dvv "${APP}" 2>&1 | grep -q "flags=0x10000(runtime)" || { echo "Hardened runtime missing"; exit 1; }
-lipo -archs "${APP}/Contents/MacOS/PureMac"
+APP_ARCHS=$(lipo -archs "${APP}/Contents/MacOS/PureMac")
+grep -qw arm64 <<< "${APP_ARCHS}" || { echo "arm64 slice missing" >&2; exit 1; }
+grep -qw x86_64 <<< "${APP_ARCHS}" || { echo "x86_64 slice missing" >&2; exit 1; }
+echo "Architectures: ${APP_ARCHS}"
-echo "==> dmg"
+echo "==> notarize app zip (profile: ${NOTARY_PROFILE})"
+NOTARY_ZIP="build/PureMac-app-notary.zip"
+ditto -c -k --keepParent --sequesterRsrc "${APP}" "${NOTARY_ZIP}"
+xcrun notarytool submit "${NOTARY_ZIP}" \
+ --keychain-profile "${NOTARY_PROFILE}" \
+ --wait --timeout 30m
+xcrun stapler staple "${APP}"
+xcrun stapler validate "${APP}"
+codesign --verify --deep --strict --verbose=2 "${APP}"
+spctl --assess --type execute --verbose=4 "${APP}"
+rm -f "${NOTARY_ZIP}"
+
+echo "==> dmg from stapled app"
create-dmg \
--volname "PureMac ${VERSION}" \
--window-size 540 360 \
@@ -91,13 +147,7 @@ create-dmg \
"${DMG}" \
build/export/PureMac.app
codesign --sign "${SIGN_ID}" --timestamp "${DMG}"
-
-echo "==> notarize app zip (profile: ${NOTARY_PROFILE})"
-ditto -c -k --keepParent --sequesterRsrc "${APP}" build/PureMac-app.zip
-xcrun notarytool submit build/PureMac-app.zip \
- --keychain-profile "${NOTARY_PROFILE}" \
- --wait --timeout 30m
-xcrun stapler staple "${APP}"
+codesign --verify --verbose=2 "${DMG}"
echo "==> notarize dmg"
xcrun notarytool submit "${DMG}" \
@@ -122,5 +172,5 @@ echo " sha256: ${DMG_SHA}"
echo "ZIP: ${ZIP}"
echo " sha256: ${ZIP_SHA}"
echo ""
-echo "Next: gh release create v${VERSION} ${DMG} ${ZIP} --title \"PureMac v${VERSION}\""
-echo "Then: bump homebrew/puremac.rb sha256 to ${ZIP_SHA}"
+echo "Canonical publish: push ${TAG} at commit ${BUILD_SHA}; the tag-triggered CI workflow uploads assets and updates both Homebrew casks."
+echo "This local script does not create tags, publish a GitHub release, or update Homebrew."