build: update #81
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 | |
| pull_request: | |
| 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 with Xcode | |
| run: | | |
| set -euo pipefail | |
| PROJECT="Micmute.xcodeproj" | |
| SCHEME="Micmute" | |
| CONFIG="Release" | |
| build_variant() { | |
| local identifier="$1" | |
| shift | |
| rm -rf "build_output/${identifier}" | |
| xcodebuild clean build \ | |
| -project "$PROJECT" \ | |
| -scheme "$SCHEME" \ | |
| -configuration "$CONFIG" \ | |
| -derivedDataPath "build_output/${identifier}" \ | |
| CODE_SIGN_IDENTITY="" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| CODE_SIGN_ENTITLEMENTS="" \ | |
| "$@" | |
| } | |
| build_variant arm64 -arch arm64 | |
| build_variant x86_64 -arch x86_64 | |
| create_universal_variant() { | |
| local universal_root="build_output/universal/Build/Products/Release" | |
| local universal_app="$universal_root/Micmute.app" | |
| local arm_app="build_output/arm64/Build/Products/Release/Micmute.app" | |
| local intel_app="build_output/x86_64/Build/Products/Release/Micmute.app" | |
| if [ ! -d "$arm_app" ] || [ ! -d "$intel_app" ]; then | |
| echo "Missing architecture build outputs; cannot create universal binary." >&2 | |
| exit 1 | |
| fi | |
| rm -rf "build_output/universal" | |
| mkdir -p "$universal_root" | |
| ditto "$arm_app" "$universal_app" | |
| while IFS= read -r arm_file; do | |
| local rel="${arm_file#${arm_app}/}" | |
| local intel_file="$intel_app/$rel" | |
| local universal_file="$universal_app/$rel" | |
| if [ ! -f "$intel_file" ]; then | |
| continue | |
| fi | |
| if file "$arm_file" | grep -q "Mach-O"; then | |
| lipo -create "$arm_file" "$intel_file" -output "$universal_file" | |
| codesign --remove-signature "$universal_file" || true | |
| fi | |
| done < <(find "$arm_app" -type f) | |
| } | |
| create_universal_variant | |
| - 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" | |
| } | |
| package_variant universal universal | |
| UNIVERSAL_ZIP="$RELEASE_DIR_ABS/Micmute-universal.zip" | |
| if [ ! -f "$UNIVERSAL_ZIP" ]; then | |
| echo "Universal zip not found at $UNIVERSAL_ZIP" >&2 | |
| exit 1 | |
| fi | |
| mv "$UNIVERSAL_ZIP" "$GITHUB_WORKSPACE"/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Micmute | |
| path: | | |
| ${{ github.workspace }}/Micmute-universal.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: Create tag if missing | |
| # run: | | |
| # TAG="v${{ steps.appver.outputs.version }}" | |
| # if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then | |
| # echo "Tag $TAG already exists" | |
| # else | |
| # git config user.name "github-actions" | |
| # git config user.email "github-actions@users.noreply.github.com" | |
| # git tag "$TAG" | |
| # git push origin "$TAG" | |
| # fi | |
| - name: Rename artifact | |
| run: | | |
| mv "Micmute-universal.zip" "Micmute-universal-${{ steps.appver.outputs.version }}.zip" | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.appver.outputs.version }} | |
| name: ${{ steps.appver.outputs.version }} | |
| files: | | |
| Micmute-universal-${{ steps.appver.outputs.version }}.zip | |
| prerelease: true | |
| make_latest: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |