refactor(dashboard): update token calculations to include input and o… #44
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 every push to main: build the collector as standalone binaries for every | |
| # desktop OS and publish a GitHub Release with them attached. | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release | |
| cancel-in-progress: true | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Compute version | |
| id: meta | |
| run: | | |
| VERSION=$(node -p "require('./collector/package.json').version") | |
| echo "tag=v${VERSION}.${{ github.run_number }}" >> "$GITHUB_OUTPUT" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| - name: Build standalone binaries | |
| working-directory: collector | |
| run: | | |
| set -euo pipefail | |
| mkdir -p dist | |
| ENTRY=src/index.ts | |
| build() { # <bun-target> <outfile> | |
| echo "→ $2" | |
| bun build "$ENTRY" --compile --target="$1" --outfile "dist/$2" | |
| } | |
| build bun-darwin-arm64 claude-track-macos-arm64 | |
| build bun-darwin-x64 claude-track-macos-x64 | |
| build bun-linux-x64 claude-track-linux-x64 | |
| build bun-linux-arm64 claude-track-linux-arm64 | |
| build bun-windows-x64 claude-track-windows-x64.exe | |
| # Portable Node bundle (run with: node claude-track.js <cmd>) | |
| bun build "$ENTRY" --target=node --outfile dist/claude-track.js | |
| chmod +x dist/claude-track-macos-* dist/claude-track-linux-* || true | |
| - name: Checksums | |
| working-directory: collector/dist | |
| run: sha256sum * > SHA256SUMS.txt | |
| - name: Publish release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.meta.outputs.tag }} | |
| name: claude-track ${{ steps.meta.outputs.tag }} | |
| body: | | |
| Standalone `claude-track` collector binaries (built from `${{ github.sha }}`). | |
| Easiest install (downloads, verifies, enables autostart): | |
| ```bash | |
| # macOS / Linux | |
| curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/install.sh | sh -s -- --token ctk_xxx | |
| ``` | |
| ```powershell | |
| # Windows | |
| $s = irm https://raw.githubusercontent.com/${{ github.repository }}/main/install.ps1 | |
| & ([scriptblock]::Create($s)) -Token ctk_xxx | |
| ``` | |
| Or grab the binary for your OS manually (make it executable first on | |
| macOS/Linux): | |
| ```bash | |
| ./claude-track init --endpoint https://your-server --token ctk_xxx | |
| ./claude-track install # autostart: launchd / systemd / Task Scheduler | |
| ``` | |
| | OS | Asset | | |
| |----|-------| | |
| | macOS (Apple Silicon) | `claude-track-macos-arm64` | | |
| | macOS (Intel) | `claude-track-macos-x64` | | |
| | Linux (x64) | `claude-track-linux-x64` | | |
| | Linux (arm64) | `claude-track-linux-arm64` | | |
| | Windows (x64) | `claude-track-windows-x64.exe` | | |
| | Any (needs Node) | `claude-track.js` | | |
| make_latest: true | |
| generate_release_notes: true | |
| files: | | |
| collector/dist/claude-track-macos-arm64 | |
| collector/dist/claude-track-macos-x64 | |
| collector/dist/claude-track-linux-x64 | |
| collector/dist/claude-track-linux-arm64 | |
| collector/dist/claude-track-windows-x64.exe | |
| collector/dist/claude-track.js | |
| collector/dist/SHA256SUMS.txt |