build: fix #86
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Beta build | ||
| on: | ||
| push: | ||
| branches: | ||
| - beta | ||
| jobs: | ||
| build: | ||
| runs-on: macos-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Swift | ||
| uses: swift-actions/setup-swift@v2 | ||
| with: | ||
| swift-version: '6.1' | ||
| - name: Install CocoaPods | ||
| run: | | ||
| brew install cocoapods || true | ||
| - name: Build per-architecture variants | ||
| run: | | ||
| set -euo pipefail | ||
| PROJECT="Micmute.xcodeproj" | ||
| SCHEME="Micmute" | ||
| CONFIG="Release" | ||
| build_variant() { | ||
| local identifier="$1" | ||
| local arch_flag="$2" | ||
| rm -rf "build_output/${identifier}" | ||
| xcodebuild clean build \ | ||
| -project "$PROJECT" \ | ||
| -scheme "$SCHEME" \ | ||
| -configuration "$CONFIG" \ | ||
| -derivedDataPath "build_output/${identifier}" \ | ||
| -arch "$arch_flag" \ | ||
| CODE_SIGN_IDENTITY="" \ | ||
| CODE_SIGNING_REQUIRED=NO \ | ||
| CODE_SIGNING_ALLOWED=NO \ | ||
| CODE_SIGN_ENTITLEMENTS="" | ||
| } | ||
| build_variant arm64 arm64 | ||
| build_variant x86_64 x86_64 | ||
| run: | | ||
| - name: Re-seal app bundles | ||
| PROJECT="Micmute.xcodeproj" | ||
| SCHEME="Micmute" | ||
| reseal_variant() { | ||
| local identifier="$1" | ||
| local app_path="build_output/${identifier}/Build/Products/Release/Micmute.app" | ||
| if [ ! -d "$app_path" ]; then | ||
| echo "App bundle not found at $app_path" >&2 | ||
| exit 1 | ||
| fi | ||
| chmod +x "$app_path/Contents/MacOS/Micmute" || true | ||
| xattr -cr "$app_path" || true | ||
| codesign -f --deep -s - "$app_path" || true | ||
| } | ||
| reseal_variant arm64 | ||
| reseal_variant x86_64 | ||
| CODE_SIGNING_REQUIRED=NO \ | ||
| - name: Verify binaries and bundles | ||
| CODE_SIGN_ENTITLEMENTS="" | ||
| - name: Verify and re-seal app bundle | ||
| verify_variant() { | ||
| local identifier="$1" | ||
| local label="$2" | ||
| local app_path="build_output/${identifier}/Build/Products/Release/Micmute.app" | ||
| echo "=== ${label} binary architecture check ===" | ||
| file "$app_path/Contents/MacOS/Micmute" | ||
| otool -hv "$app_path/Contents/MacOS/Micmute" || true | ||
| echo "=== ${label} bundle Info.plist check ===" | ||
| plutil -p "$app_path/Contents/Info.plist" | egrep 'CFBundleExecutable|CFBundleIdentifier|LSMinimumSystemVersion' || true | ||
| echo "=== ${label} code signing verification ===" | ||
| codesign -vvv --deep --strict "$app_path" || true | ||
| echo "=== ${label} Gatekeeper assessment ===" | ||
| spctl --assess --type execute -v "$app_path" || true | ||
| } | ||
| verify_variant arm64 "arm64" | ||
| verify_variant x86_64 "Intel" | ||
| # Clear extended attributes that might cause issues | ||
| xattr -cr "$APP" || true | ||
| # Re-codesign entire bundle ad-hoc for macOS 15 compatibility | ||
| codesign -f --deep -s - "$APP" || true | ||
| - name: Verify binary and bundle | ||
| run: | | ||
| set -euo pipefail | ||
| APP="build_output/universal/Build/Products/Release/Micmute.app" | ||
| echo "=== Binary architecture check ===" | ||
| file "$APP/Contents/MacOS/Micmute" | ||
| otool -hv "$APP/Contents/MacOS/Micmute" || true | ||
| echo "=== Bundle Info.plist check ===" | ||
| plutil -p "$APP/Contents/Info.plist" | egrep 'CFBundleExecutable|CFBundleIdentifier|LSMinimumSystemVersion' || true | ||
| echo "=== Code signing verification ===" | ||
| codesign -vvv --deep --strict "$APP" || true | ||
| echo "=== Gatekeeper assessment ===" | ||
| spctl --assess --type execute -v "$APP" || true | ||
| - name: Prepare release bundle | ||
| run: | | ||
| set -euo pipefail | ||
| RELEASE_DIR="build_output/Bundle" | ||
| RELEASE_DIR_ABS="$(pwd)/$RELEASE_DIR" | ||
| mkdir -p "$RELEASE_DIR_ABS" | ||
| package_variant() { | ||
| local identifier="$1" | ||
| local label="$2" | ||
| local source="build_output/${identifier}/Build/Products/Release/Micmute.app" | ||
| local staging="$RELEASE_DIR_ABS/staging-${label}" | ||
| rm -rf "$staging" | ||
| mkdir -p "$staging" | ||
| ditto "$source" "$staging/Micmute.app" | ||
| pushd "$staging" >/dev/null | ||
| ditto -c -k --sequesterRsrc --keepParent "Micmute.app" "$RELEASE_DIR_ABS/Micmute-${label}.zip" | ||
| popd >/dev/null | ||
| rm -rf "$staging" | ||
| local zip_path="$RELEASE_DIR_ABS/Micmute-${label}.zip" | ||
| if [ ! -f "$zip_path" ]; then | ||
| echo "Zip not found at $zip_path" >&2 | ||
| exit 1 | ||
| fi | ||
| mv "$zip_path" "$GITHUB_WORKSPACE"/ | ||
| } | ||
| package_variant arm64 arm64 | ||
| package_variant x86_64 intel | ||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: Micmute | ||
| path: | | ||
| ${{ github.workspace }}/Micmute-arm64.zip | ||
| ${{ github.workspace }}/Micmute-intel.zip | ||
| release: | ||
| needs: build | ||
| runs-on: macos-15 | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Download artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: Micmute | ||
| path: . | ||
| - name: Read app version from Xcode settings | ||
| id: appver | ||
| run: | | ||
| VERSION=$(xcodebuild -project Micmute.xcodeproj -scheme Micmute -showBuildSettings | awk -F= '/MARKETING_VERSION/ {gsub(/ /,"",$2); print $2; exit}') | ||
| if [ -z "$VERSION" ]; then | ||
| echo "MARKETING_VERSION not found. Ensure it's set in target Build Settings." >&2 | ||
| exit 1 | ||
| fi | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| - name: Rename artifacts | ||
| run: | | ||
| mv "Micmute-arm64.zip" "Micmute-arm64-${{ steps.appver.outputs.version }}-preview.zip" | ||
| mv "Micmute-intel.zip" "Micmute-intel-${{ steps.appver.outputs.version }}-preview.zip" | ||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: preview | ||
| name: ${{ steps.appver.outputs.version }}-preview | ||
| files: | | ||
| Micmute-arm64-${{ steps.appver.outputs.version }}-preview.zip | ||
| Micmute-intel-${{ steps.appver.outputs.version }}-preview.zip | ||
| prerelease: true | ||
| make_latest: false | ||
| body: | | ||
| ### Installation Notes | ||
| This is an unsigned build. You may need to: | ||
| 1. Right-click the app and select "Open" the first time | ||
| 2. Or remove quarantine in Terminal: `xattr -dr com.apple.quarantine /Applications/Micmute.app` | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||