From 2f92914be8a698690e046d9fd8a9e3570f329a83 Mon Sep 17 00:00:00 2001 From: zhenghaoz Date: Mon, 19 Oct 2026 21:21:27 +0800 Subject: [PATCH 1/6] ci: publish macOS, Windows and Linux release binaries --- .github/workflows/release.yml | 98 +++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b05d3b7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,98 @@ +name: Release + +on: + release: + types: [published] + pull_request: + +permissions: + contents: read + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - os: macos-15 + asset: clap-macos-arm64 + binary: build/clap + cmake_args: -DCMAKE_OSX_ARCHITECTURES=arm64 -DGGML_METAL=ON -DGGML_METAL_EMBED_LIBRARY=ON + - os: windows-2022 + asset: clap-windows-amd64-cpu + binary: build/Release/clap.exe + cmake_args: -A x64 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DGGML_METAL=OFF + - os: ubuntu-22.04 + asset: clap-linux-amd64-cpu + binary: build/clap + cmake_args: -DGGML_METAL=OFF + - os: ubuntu-22.04-arm + asset: clap-linux-arm64-cpu + binary: build/clap + cmake_args: -DGGML_METAL=OFF + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Configure + run: >- + cmake -S . -B build + -DCMAKE_BUILD_TYPE=Release + -DBUILD_TESTING=OFF + -DBUILD_SHARED_LIBS=OFF + -DGGML_NATIVE=OFF + -DGGML_BACKEND_DL=OFF + -DGGML_OPENMP=OFF + -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF + -DHTTPLIB_USE_ZLIB_IF_AVAILABLE=OFF + -DHTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF + -DHTTPLIB_USE_ZSTD_IF_AVAILABLE=OFF + ${{ matrix.cmake_args }} + - name: Build + run: cmake --build build --config Release --target clap-cli --parallel + - name: Smoke test + env: + BINARY: ${{ matrix.binary }} + run: | + "$BINARY" --help + "$BINARY" embedding -p "Hello World!" + - name: Prepare executable + env: + BINARY: ${{ matrix.binary }} + ASSET: ${{ matrix.asset }} + run: | + mkdir -p dist + cp "$BINARY" "dist/$ASSET" + - name: Verify macOS architecture + if: runner.os == 'macOS' + run: lipo -verify_arch arm64 dist/clap-macos-arm64 + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.asset }} + path: dist/${{ matrix.asset }} + if-no-files-found: error + + upload-release: + if: github.event_name == 'release' + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + pattern: clap-* + merge-multiple: true + path: dist + - name: Upload release assets + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + run: | + chmod +x dist/clap-* + gh release upload "$RELEASE_TAG" dist/clap-* --clobber From 37069e93936ced7f60ec1c7cc5e22d8783b7b6aa Mon Sep 17 00:00:00 2001 From: zhenghaoz Date: Mon, 19 Oct 2026 21:27:48 +0800 Subject: [PATCH 2/6] ci: add Windows ARM64 release and fix architecture check --- .github/workflows/release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b05d3b7..1552ab1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,10 @@ jobs: asset: clap-windows-amd64-cpu binary: build/Release/clap.exe cmake_args: -A x64 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DGGML_METAL=OFF + - os: windows-11-arm + asset: clap-windows-arm64-cpu + binary: build/Release/clap.exe + cmake_args: -A ARM64 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DGGML_METAL=OFF - os: ubuntu-22.04 asset: clap-linux-amd64-cpu binary: build/clap @@ -69,7 +73,7 @@ jobs: cp "$BINARY" "dist/$ASSET" - name: Verify macOS architecture if: runner.os == 'macOS' - run: lipo -verify_arch arm64 dist/clap-macos-arm64 + run: lipo dist/clap-macos-arm64 -verify_arch arm64 - uses: actions/upload-artifact@v4 with: name: ${{ matrix.asset }} From 5075734f14596238c03a8d0d17af60d73b69d13c Mon Sep 17 00:00:00 2001 From: zhenghaoz Date: Mon, 19 Oct 2026 21:32:06 +0800 Subject: [PATCH 3/6] ci: use exe asset names and ClangCL for Windows ARM64 --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1552ab1..1b8553b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,13 +19,13 @@ jobs: binary: build/clap cmake_args: -DCMAKE_OSX_ARCHITECTURES=arm64 -DGGML_METAL=ON -DGGML_METAL_EMBED_LIBRARY=ON - os: windows-2022 - asset: clap-windows-amd64-cpu + asset: clap-windows-amd64-cpu.exe binary: build/Release/clap.exe cmake_args: -A x64 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DGGML_METAL=OFF - os: windows-11-arm - asset: clap-windows-arm64-cpu + asset: clap-windows-arm64-cpu.exe binary: build/Release/clap.exe - cmake_args: -A ARM64 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DGGML_METAL=OFF + cmake_args: -A ARM64 -T ClangCL -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DGGML_METAL=OFF - os: ubuntu-22.04 asset: clap-linux-amd64-cpu binary: build/clap From dccea5e4043aedb5c4f7c337d5db73d0e2dba412 Mon Sep 17 00:00:00 2001 From: zhenghaoz Date: Mon, 19 Oct 2026 21:40:23 +0800 Subject: [PATCH 4/6] ci: only build release binaries on release publication --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b8553b..8b4680d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,6 @@ name: Release on: release: types: [published] - pull_request: permissions: contents: read From 79c148c1b24ed3ba0656d23ea21b4a3c7ec94a1b Mon Sep 17 00:00:00 2001 From: zhenghaoz Date: Mon, 19 Oct 2026 21:47:14 +0800 Subject: [PATCH 5/6] ci: upload release assets directly from each build job --- .github/workflows/release.yml | 37 +++++------------------------------ 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8b4680d..30eff1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: types: [published] permissions: - contents: read + contents: write jobs: build: @@ -57,12 +57,7 @@ jobs: ${{ matrix.cmake_args }} - name: Build run: cmake --build build --config Release --target clap-cli --parallel - - name: Smoke test - env: - BINARY: ${{ matrix.binary }} - run: | - "$BINARY" --help - "$BINARY" embedding -p "Hello World!" + - name: Prepare executable env: BINARY: ${{ matrix.binary }} @@ -70,32 +65,10 @@ jobs: run: | mkdir -p dist cp "$BINARY" "dist/$ASSET" - - name: Verify macOS architecture - if: runner.os == 'macOS' - run: lipo dist/clap-macos-arm64 -verify_arch arm64 - - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.asset }} - path: dist/${{ matrix.asset }} - if-no-files-found: error - - upload-release: - if: github.event_name == 'release' - needs: build - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/download-artifact@v4 - with: - pattern: clap-* - merge-multiple: true - path: dist - - name: Upload release assets + - name: Upload release asset env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} RELEASE_TAG: ${{ github.event.release.tag_name }} - run: | - chmod +x dist/clap-* - gh release upload "$RELEASE_TAG" dist/clap-* --clobber + ASSET: ${{ matrix.asset }} + run: gh release upload "$RELEASE_TAG" "dist/$ASSET" --clobber From 4efc1da11910cdce654cffb65f1dc3e263105511 Mon Sep 17 00:00:00 2001 From: zhenghaoz Date: Mon, 19 Oct 2026 21:50:29 +0800 Subject: [PATCH 6/6] ci: rename binaries in the release upload step --- .github/workflows/release.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30eff1b..2019063 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,17 +58,13 @@ jobs: - name: Build run: cmake --build build --config Release --target clap-cli --parallel - - name: Prepare executable - env: - BINARY: ${{ matrix.binary }} - ASSET: ${{ matrix.asset }} - run: | - mkdir -p dist - cp "$BINARY" "dist/$ASSET" - name: Upload release asset env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} RELEASE_TAG: ${{ github.event.release.tag_name }} + BINARY: ${{ matrix.binary }} ASSET: ${{ matrix.asset }} - run: gh release upload "$RELEASE_TAG" "dist/$ASSET" --clobber + run: | + mv "$BINARY" "$ASSET" + gh release upload "$RELEASE_TAG" "$ASSET" --clobber