Skip to content

Commit f395155

Browse files
committed
feat: Enhance VTCode distribution setup and publishing workflows
- Updated Cargo.toml with metadata including authors, description, license, and keywords. - Added GitHub Actions workflows for building and releasing binaries across multiple platforms. - Created a workflow for publishing the crate to crates.io upon release. - Documented the distribution setup process in DISTRIBUTION_SETUP.md and DISTRIBUTION_SETUP_GUIDE.md. - Implemented Homebrew formula for VTCode with placeholders for SHA256 checksums. - Developed npm package structure with installation scripts for binary downloads. - Added scripts for setting up and testing the distribution configuration.
1 parent 5389385 commit f395155

File tree

17 files changed

+1498
-33
lines changed

17 files changed

+1498
-33
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build and Release Binaries
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
strategy:
10+
matrix:
11+
include:
12+
- os: ubuntu-latest
13+
target: x86_64-unknown-linux-gnu
14+
name: linux-x64
15+
- os: macos-latest
16+
target: x86_64-apple-darwin
17+
name: macos-x64
18+
- os: macos-latest
19+
target: aarch64-apple-darwin
20+
name: macos-arm64
21+
- os: windows-latest
22+
target: x86_64-pc-windows-msvc
23+
name: windows-x64
24+
25+
runs-on: ${{ matrix.os }}
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Setup Rust
32+
uses: dtolnay/rust-toolchain@stable
33+
with:
34+
targets: ${{ matrix.target }}
35+
36+
- name: Cache dependencies
37+
uses: Swatinem/rust-cache@v2
38+
39+
- name: Build release binary
40+
run: cargo build --release --target ${{ matrix.target }}
41+
42+
- name: Package binary (Unix)
43+
if: matrix.os != 'windows-latest'
44+
run: |
45+
cd target/${{ matrix.target }}/release
46+
tar -czf ../../../vtcode-v${{ github.event.release.tag_name }}-x86_64-${{ matrix.name }}.tar.gz vtcode
47+
48+
- name: Package binary (Windows)
49+
if: matrix.os == 'windows-latest'
50+
run: |
51+
cd target/${{ matrix.target }}/release
52+
7z a ../../../vtcode-v${{ github.event.release.tag_name }}-x86_64-${{ matrix.name }}.zip vtcode.exe
53+
54+
- name: Upload binary
55+
uses: actions/upload-release-asset@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
upload_url: ${{ github.event.release.upload_url }}
60+
asset_path: ./vtcode-v${{ github.event.release.tag_name }}-${{ matrix.name }}.${{ matrix.os == 'windows-latest' && 'zip' || 'tar.gz' }}
61+
asset_name: vtcode-v${{ github.event.release.tag_name }}-${{ matrix.name }}.${{ matrix.os == 'windows-latest' && 'zip' || 'tar.gz' }}
62+
asset_content_type: application/${{ matrix.os == 'windows-latest' && 'zip' || 'gzip' }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish to Crates.io
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Rust
15+
uses: dtolnay/rust-toolchain@stable
16+
17+
- name: Cache dependencies
18+
uses: Swatinem/rust-cache@v2
19+
20+
- name: Verify Cargo authentication
21+
run: |
22+
if [ -z "$CRATES_IO_TOKEN" ]; then
23+
echo "CRATES_IO_TOKEN secret is not set"
24+
echo "Please set up the CRATES_IO_TOKEN secret in your repository settings"
25+
echo "Get your token from: https://crates.io/me"
26+
exit 1
27+
fi
28+
env:
29+
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
30+
31+
- name: Publish vtcode-core
32+
run: cargo publish --manifest-path vtcode-core/Cargo.toml --token "$CRATES_IO_TOKEN"
33+
env:
34+
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
35+
36+
- name: Wait for vtcode-core to be available
37+
run: sleep 30
38+
39+
- name: Publish vtcode
40+
run: cargo publish --token "$CRATES_IO_TOKEN"
41+
env:
42+
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22
name = "vtcode"
33
version = "0.8.0"
44
edition = "2024"
5+
authors = ["vinhnx <vinhnx@users.noreply.github.com>"]
6+
description = "A Rust-based terminal coding agent with modular architecture supporting multiple LLM providers"
7+
license = "MIT"
8+
readme = "README.md"
9+
homepage = "https://github.com/vinhnx/vtcode"
10+
repository = "https://github.com/vinhnx/vtcode"
11+
keywords = [
12+
"ai",
13+
"coding",
14+
"agent",
15+
"llm",
16+
"cli",
17+
"terminal",
18+
"rust",
19+
"automation",
20+
]
21+
categories = ["command-line-utilities", "development-tools", "api-bindings"]
22+
exclude = [
23+
"target/",
24+
".github/",
25+
"docs/",
26+
"scripts/",
27+
"screenshots/",
28+
"logs/",
29+
"prompts/",
30+
]
531
default-run = "vtcode"
632

733
[workspace]

README.md

Lines changed: 83 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,45 @@ VTCode is a Rust-based terminal coding agent with modular architecture supportin
3939

4040
### Prerequisites
4141

42+
**For pre-built installations (Cargo, Homebrew, npm):** None - binaries are ready to use.
43+
44+
**For building from source:**
45+
4246
- Rust 1.75+ (stable)
43-
- API key for your preferred LLM provider:
44-
- `GEMINI_API_KEY` or `GOOGLE_API_KEY` for Gemini
45-
- `OPENAI_API_KEY` for OpenAI
46-
- `ANTHROPIC_API_KEY` for Anthropic
47-
- `DEEPSEEK_API_KEY` for DeepSeek
47+
48+
**API Keys (required for all installation methods):**
49+
50+
- `GEMINI_API_KEY` or `GOOGLE_API_KEY` for Gemini
51+
- `OPENAI_API_KEY` for OpenAI
52+
- `ANTHROPIC_API_KEY` for Anthropic
53+
- `DEEPSEEK_API_KEY` for DeepSeek
4854

4955
### Installation
5056

57+
#### Option 1: Cargo (crates.io) - Recommended for Rust developers
58+
59+
```bash
60+
cargo install vtcode
61+
```
62+
63+
#### Option 2: Homebrew (macOS)
64+
65+
```bash
66+
brew install vinhnx/tap/vtcode
67+
```
68+
69+
#### Option 3: npm (Cross-platform)
70+
71+
```bash
72+
npm install -g vtcode
73+
```
74+
75+
#### Option 4: Pre-built binaries
76+
77+
Download the latest release from [GitHub Releases](https://github.com/vinhnx/vtcode/releases) for your platform.
78+
79+
#### Option 5: Build from source
80+
5181
```bash
5282
# Clone the repository
5383
git clone https://github.com/vinhnx/vtcode.git
@@ -749,3 +779,51 @@ Example:
749779
default_policy = "prompt"
750780
max_tool_loops = 100
751781
```
782+
783+
### Distribution & Releases
784+
785+
VTCode supports multiple distribution channels for easy installation:
786+
787+
#### Release Process
788+
789+
The project uses an automated release script that handles publishing to multiple package managers:
790+
791+
```bash
792+
# Create a patch release (increments 0.1.0 → 0.1.1)
793+
./scripts/release.sh --patch
794+
795+
# Create a minor release (increments 0.1.0 → 0.2.0)
796+
./scripts/release.sh --minor
797+
798+
# Create a major release (increments 0.1.0 → 1.0.0)
799+
./scripts/release.sh --major
800+
801+
# Release a specific version
802+
./scripts/release.sh 1.0.0
803+
804+
# Dry run to see what would happen
805+
./scripts/release.sh --patch --dry-run
806+
807+
# Skip certain distribution channels
808+
./scripts/release.sh --patch --skip-npm --skip-homebrew
809+
```
810+
811+
#### Distribution Channels
812+
813+
1. **Cargo (crates.io)**: `cargo install vtcode`
814+
2. **npm**: `npm install -g vtcode`
815+
3. **Homebrew**: `brew install vinhnx/tap/vtcode`
816+
4. **GitHub Releases**: Pre-built binaries for all platforms
817+
818+
#### Setup for Distribution
819+
820+
To set up publishing to these channels:
821+
822+
```bash
823+
# Run the setup script for guidance
824+
./scripts/setup-distribution.sh
825+
826+
# Follow the prompts to set up authentication for each channel
827+
```
828+
829+
For detailed setup instructions, see: [Distribution Setup Guide](docs/project/DISTRIBUTION_SETUP_GUIDE.md)

docs/project/DISTRIBUTION_SETUP.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# VTCode Distribution Setup
2+
3+
This document outlines the complete distribution setup for VTCode across multiple package managers and platforms.
4+
5+
## Distribution Channels
6+
7+
### 1. Cargo (crates.io)
8+
9+
- **Primary Rust package repository**
10+
- **Location**: `https://crates.io/crates/vtcode`
11+
- **Workflow**: `.github/workflows/publish-crates.yml`
12+
- **Metadata**: Added to `Cargo.toml` and `vtcode-core/Cargo.toml`
13+
14+
### 2. Homebrew (macOS)
15+
16+
- **Formula**: `homebrew/vtcode.rb`
17+
- **Installation**: `brew install vinhnx/tap/vtcode`
18+
- **Binaries**: Downloaded from GitHub Releases
19+
20+
### 3. npm (Cross-platform)
21+
22+
- **Package**: `@vinhnx/vtcode` (when published)
23+
- **Installation**: `npm install -g vtcode`
24+
- **Structure**: `npm/` directory with postinstall script
25+
26+
### 4. GitHub Releases
27+
28+
- **Binaries**: Pre-built for multiple platforms
29+
- **Workflow**: `.github/workflows/build-release.yml`
30+
- **Platforms**: Linux x64, macOS x64/ARM64, Windows x64
31+
32+
## File Structure
33+
34+
```
35+
vtcode/
36+
├── Cargo.toml # Main crate metadata
37+
├── vtcode-core/
38+
│ └── Cargo.toml # Core library metadata
39+
├── homebrew/
40+
│ └── vtcode.rb # Homebrew formula
41+
├── npm/
42+
│ ├── package.json # npm package config
43+
│ ├── index.js # Main entry point
44+
│ ├── bin/
45+
│ │ └── vtcode # Executable wrapper
46+
│ └── scripts/
47+
│ ├── postinstall.js # Binary download script
48+
│ └── preuninstall.js # Cleanup script
49+
├── .github/workflows/
50+
│ ├── publish-crates.yml # Cargo publishing
51+
│ ├── build-release.yml # Binary builds
52+
│ └── release.yml # Release creation
53+
└── scripts/
54+
├── release.sh # Release management
55+
└── test-distribution.sh # Distribution validation
56+
```
57+
58+
## Release Process
59+
60+
1. **Create Release**: Use `./scripts/release.sh` to bump version and create git tag
61+
2. **Build Binaries**: GitHub Actions automatically builds binaries for all platforms
62+
3. **Publish to Cargo**: Automatically publishes to crates.io
63+
4. **Manual Steps**:
64+
- Publish npm package: `cd npm && npm publish`
65+
- Update Homebrew formula with correct SHA256 hashes
66+
- Create Homebrew tap if needed
67+
68+
## Validation
69+
70+
Run `./scripts/test-distribution.sh` to validate the entire setup before releasing.
71+
72+
## Secrets Required
73+
74+
- `CRATES_IO_TOKEN`: For publishing to crates.io
75+
- `GITHUB_TOKEN`: Automatically provided by GitHub Actions
76+
77+
## Next Steps
78+
79+
1. Create a test release to validate the pipeline
80+
2. Set up npm publishing (requires npm account)
81+
3. Create Homebrew tap repository
82+
4. Update documentation with final installation URLs

0 commit comments

Comments
 (0)