From beb72d5946ac90d6a0358bc805f41569ccda0a15 Mon Sep 17 00:00:00 2001 From: Nick Huang <9151347+nick322@users.noreply.github.com> Date: Thu, 2 Apr 2026 08:47:15 +0800 Subject: [PATCH 1/4] Add GitHub Actions workflow for CI build and release Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/build.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..67fdada --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build + +on: + push: + branches: [master] + tags: ['v*'] + pull_request: + branches: [master] + +jobs: + build: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install CocoaPods + run: pod install + + - name: Build + run: | + xcodebuild -workspace ocr.xcworkspace \ + -scheme ocr \ + -configuration Release \ + CODE_SIGN_IDENTITY="-" \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=NO + + - name: Prepare artifact + run: | + cp "$(xcodebuild -workspace ocr.xcworkspace -scheme ocr -configuration Release -showBuildSettings \ + | grep -m1 'BUILT_PRODUCTS_DIR' | awk '{print $3}')/ocr" ocr + chmod +x ocr + tar czf macOCR.tar.gz ocr + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: macOCR + path: macOCR.tar.gz + + - name: Create Release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 + with: + files: macOCR.tar.gz From 6b397fe04198627ccf5f3c021d8cfbc8e503753a Mon Sep 17 00:00:00 2001 From: Nick Huang <9151347+nick322@users.noreply.github.com> Date: Thu, 2 Apr 2026 08:55:11 +0800 Subject: [PATCH 2/4] Build separate binaries for x86_64 and arm64 architectures Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/build.yml | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67fdada..ecb91fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,9 @@ on: jobs: build: runs-on: macos-latest + strategy: + matrix: + arch: [x86_64, arm64] steps: - uses: actions/checkout@v4 @@ -17,11 +20,13 @@ jobs: - name: Install CocoaPods run: pod install - - name: Build + - name: Build (${{ matrix.arch }}) run: | xcodebuild -workspace ocr.xcworkspace \ -scheme ocr \ -configuration Release \ + ARCHS="${{ matrix.arch }}" \ + ONLY_ACTIVE_ARCH=NO \ CODE_SIGN_IDENTITY="-" \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGNING_ALLOWED=NO @@ -31,16 +36,29 @@ jobs: cp "$(xcodebuild -workspace ocr.xcworkspace -scheme ocr -configuration Release -showBuildSettings \ | grep -m1 'BUILT_PRODUCTS_DIR' | awk '{print $3}')/ocr" ocr chmod +x ocr - tar czf macOCR.tar.gz ocr + lipo -info ocr + tar czf macOCR-${{ matrix.arch }}.tar.gz ocr - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: macOCR - path: macOCR.tar.gz + name: macOCR-${{ matrix.arch }} + path: macOCR-${{ matrix.arch }}.tar.gz + + release: + needs: build + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + merge-multiple: true - name: Create Release - if: startsWith(github.ref, 'refs/tags/v') uses: softprops/action-gh-release@v2 with: - files: macOCR.tar.gz + files: | + macOCR-x86_64.tar.gz + macOCR-arm64.tar.gz From e10e265db412ba91d18757cdcd448e1a24e6b3d9 Mon Sep 17 00:00:00 2001 From: Nick Huang <9151347+nick322@users.noreply.github.com> Date: Thu, 2 Apr 2026 08:58:29 +0800 Subject: [PATCH 3/4] Fix artifact path using -derivedDataPath instead of showBuildSettings Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecb91fa..79cc00c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,7 @@ jobs: xcodebuild -workspace ocr.xcworkspace \ -scheme ocr \ -configuration Release \ + -derivedDataPath build \ ARCHS="${{ matrix.arch }}" \ ONLY_ACTIVE_ARCH=NO \ CODE_SIGN_IDENTITY="-" \ @@ -33,8 +34,7 @@ jobs: - name: Prepare artifact run: | - cp "$(xcodebuild -workspace ocr.xcworkspace -scheme ocr -configuration Release -showBuildSettings \ - | grep -m1 'BUILT_PRODUCTS_DIR' | awk '{print $3}')/ocr" ocr + cp build/Build/Products/Release/ocr ocr chmod +x ocr lipo -info ocr tar czf macOCR-${{ matrix.arch }}.tar.gz ocr From b7af0aff63fde2c7932bd682812ee3e059de6337 Mon Sep 17 00:00:00 2001 From: Nick Huang <9151347+nick322@users.noreply.github.com> Date: Thu, 2 Apr 2026 09:02:17 +0800 Subject: [PATCH 4/4] Replace lipo -info with file command for binary verification Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79cc00c..8bf51c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: run: | cp build/Build/Products/Release/ocr ocr chmod +x ocr - lipo -info ocr + file ocr tar czf macOCR-${{ matrix.arch }}.tar.gz ocr - name: Upload artifact