# Deployment Guide

Quick instructions for deploying a new version of the Text Texture Generator addon.

## Prerequisites

- Git repository with proper tags
- Python 3.10+
- All changes committed and pushed to main branch

## Deployment Steps

### 1. Create Version Tag

```bash
# Create and push a version tag
git tag v1.1.0
git push origin v1.1.0
```

### 2. Generate Changelog (Optional)

```bash
# Generate changelog for the new version
python3 build/generate_changelog.py --version 1.1.0 --output CHANGELOG_v1.1.0.md

# Or generate full changelog
python3 build/generate_changelog.py --full --output CHANGELOG.md
```

### 3. Build Packages

```bash
# Build both versions (recommended)
python3 scripts/build_addon.py --type all --version 1.1.0

# Or build individually:
# python3 scripts/build_addon.py --type full --version 1.1.0
# python3 scripts/build_addon.py --type free --version 1.1.0
```

### 4. Validate Packages

```bash
# Validate the generated packages
python3 build/validate_package.py dist/text_texture_generator_v1.1.0.zip --type full
python3 build/validate_package.py dist/text_texture_generator_v1.1.0_free.zip --type free
```

### 5. Deploy

Upload the validated packages from the `dist/` directory:

- `text_texture_generator_v1.1.0.zip` (Full version)
- `text_texture_generator_v1.1.0_free.zip` (Free version)

## Build System Overview

The deployment uses a sophisticated build-time file exclusion system:

- **Version Sync**: [`sync_version.py`](build/sync_version.py) automatically updates version information from git tags
- **Package Build**: [`build_addon.py`](scripts/build_addon.py) creates separate packages with different feature sets
- **Validation**: [`validate_package.py`](build/validate_package.py) ensures package integrity
- **Changelog**: [`generate_changelog.py`](build/generate_changelog.py) creates release notes from git history

## Configuration Files

- [`build/config.json`](build/config.json) - Project metadata and build settings
- [`build/file_exclusions.json`](build/file_exclusions.json) - Defines which files are excluded from free builds

## Troubleshooting

### No Git Tags Found

If version sync fails, ensure you have created and pushed the version tag:

```bash
git tag -l  # List existing tags
git tag v1.1.0  # Create new tag
git push origin v1.1.0  # Push to remote
```

### Build Validation Fails

Check the validation output for specific errors:

```bash
python3 build/validate_package.py dist/your_package.zip --type full
```

### Version Mismatch

The build system automatically syncs versions from git tags. If you need to override:

```bash
python3 build/sync_version.py --version 1.1.0 --type full
```

## Quick Deploy Command

For experienced users, deploy in one command:

```bash
git tag v1.1.0 && git push origin v1.1.0 && python3 scripts/build_addon.py --type all --version 1.1.0 && python3 build/validate_package.py dist/text_texture_generator_v1.1.0.zip && python3 build/validate_package.py dist/text_texture_generator_v1.1.0_free.zip
```
