npm package: @nashihamm/capacitor-release-cli
Description: CLI tool to automate mobile app releases for React Native and Capacitor projects
Author: Nashih Amin
Latest version: 1.0.0

# Capacitor Release CLI

🚀 CLI tool to automate mobile app releases for React Native and Capacitor projects.

[![npm version](https://badge.fury.io/js/@nashihamm%2Fcapacitor-release-cli.svg)](https://www.npmjs.com/package/@nashihamm/capacitor-release-cli)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Features

- ✅ **Android Automation** (60% automated)
  - Version management
  - Build & signing
  - AAB archiving with timestamps
  - Git integration
  
- ✅ **iOS Automation** (50% automated)
  - Version management
  - Asset generation (icons & splash)
  - Build preparation
  - IPA archiving

- ✅ **Additional Features**
  - Interactive setup
  - Configuration management
  - Changelog generation
  - Version bumping

## Installation

```bash
# Global installation
npm install -g @nashihamm/capacitor-release-cli

# Or with pnpm
pnpm add -g @nashihamm/capacitor-release-cli
```

## Quick Start

### 1. Initialize in Your Project

```bash
cd your-capacitor-project
cap-release init
```

This will:
- Copy automation scripts to `scripts/`
- Copy documentation to `docs/`
- Create `releases/` directory
- Update `.gitignore`

### 2. Configure (Optional)

```bash
cap-release config
```

### 3. Release Android

```bash
cap-release android 1.0.0 minor
```

### 4. Release iOS

```bash
cap-release ios 1.0.0 1
```

## Commands

### `cap-release init`
Initialize automation in current project

### `cap-release android <version> [type]`
Release Android app
- `version`: Version number (e.g., 1.0.0)
- `type`: Release type (major, minor, patch)

Example:
```bash
cap-release android 1.2.0 minor
```

### `cap-release ios <version> <build>`
Release iOS app
- `version`: Version number (e.g., 1.0.0)
- `build`: Build number (e.g., 1)

Example:
```bash
cap-release ios 1.2.0 5
```

### `cap-release config`
Configure automation settings interactively

### `cap-release version <type>`
Bump version (major, minor, patch)

Example:
```bash
cap-release version patch
```

### `cap-release changelog [days]`
Generate changelog from git history

Example:
```bash
cap-release changelog 7
```

## What Gets Automated

### Android (60% automated)
✅ Pull latest code  
✅ Update version in build.gradle  
✅ Build signed AAB  
✅ Archive with timestamp  
✅ Git commit & tag  
⚠️ Manual: Upload to Play Console

### iOS (50% automated)
✅ Pull latest code  
✅ Update version in Info.plist  
✅ Generate icons & splash screens  
✅ Build & sync to iOS  
⚠️ Manual: Archive in Xcode  
⚠️ Manual: Upload to App Store Connect

## Requirements

### For Android
- Node.js >= 14
- Android SDK
- Gradle
- Java 21

### For iOS
- macOS
- Xcode
- CocoaPods (optional)

## Documentation

After running `cap-release init`, check:
- `docs/automation/SCRIPT-REFERENCE.md` - Complete script guide
- `docs/release/workflow-complete.md` - Full release workflow
- `docs/release/RELEASE-CHECKLIST.md` - Step-by-step checklist

## Configuration

Create `cap-release.config.json` in your project:

```json
{
  "appName": "myapp",
  "androidPackage": "com.myapp",
  "iosBundleId": "com.myapp"
}
```

Or run `cap-release config` for interactive setup.

## Examples

### Complete Android Release
```bash
# 1. Initialize (first time only)
cap-release init

# 2. Configure Android signing
# Edit android/key.properties

# 3. Release
cap-release android 1.0.0 minor

# 4. Upload AAB to Play Console
# File: releases/android/myapp-v1.0.0-build1-latest.aab
```

### Complete iOS Release
```bash
# 1. Initialize (first time only)
cap-release init

# 2. Prepare release
cap-release ios 1.0.0 1

# 3. Archive in Xcode
# Product → Archive

# 4. Distribute to App Store Connect
```

## Troubleshooting

### Android build fails
```bash
# Clean build
cd android
./gradlew clean
cd ..

# Try again
cap-release android 1.0.0 minor
```

### iOS version not updating
```bash
# Check Info.plist exists
ls ios/App/App/Info.plist

# Manually update if needed
```

### Scripts not executable
```bash
chmod +x scripts/*.sh
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## License

MIT © [Nashih Amin](https://github.com/nashihamm)

## Author

**Nashih Amin**
- GitHub: [@nashihamm](https://github.com/nashihamm)
- Email: nashihamm@gmail.com

## Acknowledgments

- Built for automating Capacitor mobile app releases
- Inspired by the need for faster, more reliable mobile deployments
- Thanks to the Capacitor and React Native communities

## Support

- 🐛 [Report bugs](https://github.com/nashihamm/capacitor-release-cli/issues)
- 💡 [Request features](https://github.com/nashihamm/capacitor-release-cli/issues)
- ⭐ [Star on GitHub](https://github.com/nashihamm/capacitor-release-cli)

---

**Made with ❤️ for the mobile development community**