Replaces simple process.argv[2] with a proper arg loop that handles b… #10
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-latest | |
| binary: ccli-linux-x64 | |
| - runner: ubuntu-24.04-arm | |
| binary: ccli-linux-arm64 | |
| - runner: windows-latest | |
| binary: ccli-win-x64.exe | |
| runs-on: ${{ matrix.runner }} | |
| name: Build ${{ matrix.binary }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: npm ci | |
| - name: Build SEA binary | |
| run: node scripts/sea-build.js ${{ matrix.binary }} | |
| - name: Smoke test | |
| shell: bash | |
| run: | | |
| if [[ "${{ matrix.binary }}" == *.exe ]]; then | |
| ./dist/${{ matrix.binary }} --version | |
| else | |
| chmod +x ./dist/${{ matrix.binary }} | |
| ./dist/${{ matrix.binary }} --version | |
| fi | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.binary }} | |
| path: dist/${{ matrix.binary }} | |
| build-macos: | |
| runs-on: macos-latest | |
| name: Build ccli-macos-universal | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| id: setup-node | |
| with: | |
| node-version: 22 | |
| - run: npm ci | |
| # ── arm64 slice (native on macos-latest) ───────────────────────────── | |
| - name: Build arm64 slice | |
| run: node scripts/sea-build.js ccli-macos-arm64 | |
| - name: Smoke test arm64 | |
| run: | | |
| chmod +x dist/ccli-macos-arm64 | |
| ./dist/ccli-macos-arm64 --version | |
| # ── x64 slice (cross-build using downloaded x64 Node) ──────────────── | |
| - name: Download Node x64 binary | |
| id: node-x64 | |
| run: | | |
| NODE_VERSION="${{ steps.setup-node.outputs.node-version }}" | |
| TARBALL="node-v${NODE_VERSION}-darwin-x64.tar.gz" | |
| URL="https://nodejs.org/dist/v${NODE_VERSION}/${TARBALL}" | |
| echo "Downloading ${URL}" | |
| curl -fsSL "$URL" -o "$TARBALL" | |
| tar xzf "$TARBALL" | |
| NODE_X64="$(pwd)/node-v${NODE_VERSION}-darwin-x64/bin/node" | |
| echo "node_x64=${NODE_X64}" >> "$GITHUB_OUTPUT" | |
| file "$NODE_X64" | |
| - name: Build x64 slice | |
| run: node scripts/sea-build.js ccli-macos-x64 --node-binary "${{ steps.node-x64.outputs.node_x64 }}" | |
| - name: Smoke test x64 | |
| run: | | |
| chmod +x dist/ccli-macos-x64 | |
| arch -x86_64 ./dist/ccli-macos-x64 --version | |
| # ── Universal binary ───────────────────────────────────────────────── | |
| - name: Create universal binary | |
| run: | | |
| lipo -create dist/ccli-macos-arm64 dist/ccli-macos-x64 -output dist/ccli-macos-universal | |
| codesign --sign - dist/ccli-macos-universal | |
| file dist/ccli-macos-universal | |
| - name: Smoke test universal (arm64) | |
| run: ./dist/ccli-macos-universal --version | |
| - name: Smoke test universal (x86_64) | |
| run: arch -x86_64 ./dist/ccli-macos-universal --version | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ccli-macos-universal | |
| path: dist/ccli-macos-universal | |
| release: | |
| needs: [build, build-macos] | |
| runs-on: ubuntu-latest | |
| name: Create Release | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: ls -lR artifacts | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| prerelease: false | |
| files: artifacts/* | |
| update-homebrew: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| name: Update Homebrew Tap | |
| steps: | |
| - name: Get version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Download release binaries | |
| run: | | |
| base="https://github.com/seabearDEV/codexCLI/releases/download/${GITHUB_REF_NAME}" | |
| for bin in ccli-macos-universal ccli-linux-x64 ccli-linux-arm64; do | |
| curl -fsSL "$base/$bin" -o "$bin" | |
| done | |
| - name: Compute SHA256 checksums | |
| id: sha | |
| run: | | |
| echo "macos_universal=$(sha256sum ccli-macos-universal | awk '{print $1}')" >> "$GITHUB_OUTPUT" | |
| echo "linux_x64=$(sha256sum ccli-linux-x64 | awk '{print $1}')" >> "$GITHUB_OUTPUT" | |
| echo "linux_arm64=$(sha256sum ccli-linux-arm64 | awk '{print $1}')" >> "$GITHUB_OUTPUT" | |
| - name: Checkout tap repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: seabearDEV/homebrew-ccli | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: homebrew-ccli | |
| - name: Generate formula | |
| env: | |
| CCLI_VERSION: ${{ steps.version.outputs.version }} | |
| SHA_MACOS_UNIVERSAL: ${{ steps.sha.outputs.macos_universal }} | |
| SHA_LINUX_X64: ${{ steps.sha.outputs.linux_x64 }} | |
| SHA_LINUX_ARM64: ${{ steps.sha.outputs.linux_arm64 }} | |
| run: | | |
| mkdir -p homebrew-ccli/Formula | |
| cat > homebrew-ccli/Formula/ccli.rb << EOF | |
| class Ccli < Formula | |
| desc "Command-line information store for quick reference of frequently used data" | |
| homepage "https://github.com/seabearDEV/codexCLI" | |
| version "$CCLI_VERSION" | |
| license "MIT" | |
| livecheck do | |
| url :stable | |
| strategy :github_latest | |
| end | |
| on_macos do | |
| url "https://github.com/seabearDEV/codexCLI/releases/download/v$CCLI_VERSION/ccli-macos-universal" | |
| sha256 "$SHA_MACOS_UNIVERSAL" | |
| end | |
| on_linux do | |
| if Hardware::CPU.arm? | |
| url "https://github.com/seabearDEV/codexCLI/releases/download/v$CCLI_VERSION/ccli-linux-arm64" | |
| sha256 "$SHA_LINUX_ARM64" | |
| else | |
| url "https://github.com/seabearDEV/codexCLI/releases/download/v$CCLI_VERSION/ccli-linux-x64" | |
| sha256 "$SHA_LINUX_X64" | |
| end | |
| end | |
| def install | |
| binary = Dir.glob("ccli-*").first | |
| bin.install binary => "ccli" | |
| end | |
| test do | |
| assert_match version.to_s, shell_output("#{bin}/ccli --version") | |
| end | |
| end | |
| EOF | |
| - name: Push updated formula | |
| working-directory: homebrew-ccli | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/ccli.rb | |
| git commit -m "Update ccli to $CCLI_VERSION" | |
| git push | |
| env: | |
| CCLI_VERSION: ${{ steps.version.outputs.version }} |