2
0

build-cli.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. name: Build CLI package
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. workflow_dispatch:
  8. env:
  9. GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }}
  10. NODE_VERSION: 20.20.0
  11. PNPM_VERSION: 10.8.1
  12. TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
  13. TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
  14. jobs:
  15. build-cli:
  16. runs-on: ubuntu-latest
  17. steps:
  18. - name: Checkout code
  19. uses: actions/checkout@v6
  20. - name: Install pnpm
  21. uses: pnpm/action-setup@v4
  22. with:
  23. version: ${{ env.PNPM_VERSION }}
  24. - name: Setup Node.js
  25. uses: actions/setup-node@v6
  26. with:
  27. node-version: ${{ env.NODE_VERSION }}
  28. cache: "pnpm"
  29. - name: Turbo cache setup
  30. uses: actions/cache@v5
  31. with:
  32. path: .turbo
  33. key: ${{ runner.os }}-turbo-${{ github.sha }}
  34. restore-keys: |
  35. ${{ runner.os }}-turbo-
  36. - name: Install dependencies
  37. run: pnpm install
  38. - name: Create .env file
  39. run: echo "KILOCODE_POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" >> .env
  40. working-directory: cli
  41. - name: Build
  42. run: pnpm run cli:bundle
  43. shell: bash
  44. - name: NPM Pack
  45. run: npm pack
  46. working-directory: cli/dist
  47. - name: Upload artifact
  48. uses: actions/upload-artifact@v6
  49. with:
  50. name: tarball
  51. path: cli/dist/*.tgz