clickup-cli 0.9.1

CLI for the ClickUp API, optimized for AI agents
Documentation
name: Build and Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write
  packages: write

jobs:
  build:
    strategy:
      matrix:
        include:
          - target: aarch64-apple-darwin
            os: macos-latest
            name: clickup-macos-arm64
          - target: x86_64-apple-darwin
            os: macos-latest
            name: clickup-macos-x86_64
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
            name: clickup-linux-x86_64
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
            name: clickup-linux-arm64
          - target: x86_64-unknown-linux-musl
            os: ubuntu-latest
            name: clickup-linux-x86_64-musl
          - target: x86_64-pc-windows-msvc
            os: windows-latest
            name: clickup-windows-x86_64

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Install cross-compilation tools (Linux ARM)
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-aarch64-linux-gnu
          echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"

      - name: Install musl tools (Linux musl)
        if: matrix.target == 'x86_64-unknown-linux-musl'
        run: |
          sudo apt-get update
          sudo apt-get install -y musl-tools

      - name: Build
        run: cargo build --release --target ${{ matrix.target }}

      - name: Package (Unix)
        if: runner.os != 'Windows'
        run: |
          cd target/${{ matrix.target }}/release
          tar czf ../../../${{ matrix.name }}.tar.gz clickup
          cd ../../..

      - name: Package (Windows)
        if: runner.os == 'Windows'
        run: |
          cd target/${{ matrix.target }}/release
          7z a ../../../${{ matrix.name }}.zip clickup.exe
          cd ../../..

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.name }}
          path: ${{ matrix.name }}.*

  verify-alpine:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Download musl artifact
        uses: actions/download-artifact@v4
        with:
          name: clickup-linux-x86_64-musl

      - name: Extract binary
        run: tar xzf clickup-linux-x86_64-musl.tar.gz

      - name: Set up Alpine chroot
        uses: jirutka/setup-alpine@v1
        with:
          branch: v3.20

      - name: Smoke-test musl binary inside Alpine
        shell: alpine.sh {0}
        run: |
          ./clickup --version
          ./clickup mcp serve --help | grep -- '--profile'
          echo "Alpine musl smoke test passed"

  release:
    needs: [build, verify-alpine]
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: Publish to crates.io
        if: ${{ !contains(github.ref_name, '-') }}
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          VERSION="${GITHUB_REF_NAME#v}"
          # Runs before artifact download so the workspace is clean; no
          # --allow-dirty needed. Earlier v0.8.0 attempt packaged the
          # downloaded release artifacts and exceeded crates.io's 10 MB cap.
          if curl -sf "https://crates.io/api/v1/crates/clickup-cli/${VERSION}" >/dev/null; then
            echo "::notice::crates.io: version ${VERSION} already exists, skipping"
          else
            cargo publish
          fi

      - name: Download all artifacts
        uses: actions/download-artifact@v4
        with:
          merge-multiple: true
          path: artifacts

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          generate_release_notes: true
          prerelease: ${{ contains(github.ref_name, '-') }}
          files: |
            artifacts/clickup-macos-arm64.tar.gz
            artifacts/clickup-macos-x86_64.tar.gz
            artifacts/clickup-linux-x86_64.tar.gz
            artifacts/clickup-linux-arm64.tar.gz
            artifacts/clickup-linux-x86_64-musl.tar.gz
            artifacts/clickup-windows-x86_64.zip

      - name: Setup Node.js
        if: ${{ !contains(github.ref_name, '-') }}
        uses: actions/setup-node@v4
        with:
          node-version: 20
          registry-url: https://registry.npmjs.org

      - name: Publish to npm
        if: ${{ !contains(github.ref_name, '-') }}
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: |
          VERSION="${GITHUB_REF_NAME#v}"
          cd npm
          npm version "${VERSION}" --no-git-tag-version --allow-same-version
          if npm view "@nick.bester/clickup-cli@${VERSION}" version >/dev/null 2>&1; then
            echo "::notice::npm: version ${VERSION} already exists, skipping"
          else
            npm publish --access public
          fi

      - name: Setup Node.js (GitHub Packages)
        if: ${{ !contains(github.ref_name, '-') }}
        uses: actions/setup-node@v4
        with:
          node-version: 20
          registry-url: https://npm.pkg.github.com
          scope: '@nicholasbester'

      - name: Publish to GitHub Packages
        if: ${{ !contains(github.ref_name, '-') }}
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          VERSION="${GITHUB_REF_NAME#v}"
          cd npm
          # Temporarily change scope for GitHub Packages
          node -e "const p=require('./package.json'); p.name='@nicholasbester/clickup-cli'; require('fs').writeFileSync('package.json', JSON.stringify(p, null, 2)+'\n')"
          npm version "${VERSION}" --no-git-tag-version --allow-same-version
          if npm view "@nicholasbester/clickup-cli@${VERSION}" version --registry https://npm.pkg.github.com >/dev/null 2>&1; then
            echo "::notice::GitHub Packages: version ${VERSION} already exists, skipping"
          else
            npm publish --access public
          fi

      - name: Update Homebrew formula
        if: ${{ !contains(github.ref_name, '-') }}
        env:
          GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
        run: |
          VERSION="${GITHUB_REF_NAME#v}"
          SHA_ARM64=$(sha256sum artifacts/clickup-macos-arm64.tar.gz | cut -d' ' -f1)
          SHA_X86_64=$(sha256sum artifacts/clickup-macos-x86_64.tar.gz | cut -d' ' -f1)
          SHA_LINUX_X86_64=$(sha256sum artifacts/clickup-linux-x86_64.tar.gz | cut -d' ' -f1)
          SHA_LINUX_ARM64=$(sha256sum artifacts/clickup-linux-arm64.tar.gz | cut -d' ' -f1)

          git clone "https://x-access-token:${GH_TOKEN}@github.com/nicholasbester/homebrew-clickup-cli.git" tap
          cd tap

          cat > Formula/clickup-cli.rb << FORMULA
          class ClickupCli < Formula
            desc "CLI for the ClickUp API, optimized for AI agents"
            homepage "https://github.com/nicholasbester/clickup-cli"
            version "${VERSION}"
            license "BUSL-1.1"

            on_macos do
              if Hardware::CPU.arm?
                url "https://github.com/nicholasbester/clickup-cli/releases/download/v${VERSION}/clickup-macos-arm64.tar.gz"
                sha256 "${SHA_ARM64}"
              else
                url "https://github.com/nicholasbester/clickup-cli/releases/download/v${VERSION}/clickup-macos-x86_64.tar.gz"
                sha256 "${SHA_X86_64}"
              end
            end

            on_linux do
              if Hardware::CPU.arm?
                url "https://github.com/nicholasbester/clickup-cli/releases/download/v${VERSION}/clickup-linux-arm64.tar.gz"
                sha256 "${SHA_LINUX_ARM64}"
              else
                url "https://github.com/nicholasbester/clickup-cli/releases/download/v${VERSION}/clickup-linux-x86_64.tar.gz"
                sha256 "${SHA_LINUX_X86_64}"
              end
            end

            def install
              bin.install "clickup"
              generate_completions_from_executable(bin/"clickup", "completions")
            end

            test do
              assert_match "clickup #{version}", shell_output("#{bin}/clickup --version")
            end
          end
          FORMULA

          # Remove leading whitespace from heredoc
          sed -i 's/^          //' Formula/clickup-cli.rb

          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add Formula/clickup-cli.rb
          git commit -m "Update clickup-cli to ${VERSION}"
          git push