# GitHub Setup & APK Build Instructions

## Step 1: Create a GitHub Repository

1. Go to https://github.com/new
2. Create a new repository named `mysportmanager-flutter`
3. **Important**: Do NOT initialize with README, .gitignore, or license (we already have these)
4. Copy the HTTPS URL (e.g., `https://github.com/YOUR_USERNAME/mysportmanager-flutter.git`)

## Step 2: Connect Local Repository to GitHub

Run these commands in `/mnt/ssd_data/mysportmanager-shared`:

```bash
cd /mnt/ssd_data/mysportmanager-shared

# Add GitHub as remote
git remote add origin https://github.com/YOUR_USERNAME/mysportmanager-flutter.git

# Rename branch to main (GitHub default)
git branch -M main

# Push code to GitHub
git push -u origin main
```

Replace `YOUR_USERNAME` with your actual GitHub username.

## Step 3: Automatic APK Build

Once you push to GitHub, the GitHub Actions workflow will automatically:

1. **Detect** the push to main branch
2. **Run** Ubuntu runner (x86-64 compatible with AAPT2)
3. **Build** the APK successfully
4. **Upload** the APK as artifact (available for 30 days)
5. **Store** in GitHub Actions artifacts

## Step 4: Download the Built APK

1. Go to your GitHub repo: https://github.com/YOUR_USERNAME/mysportmanager-flutter
2. Click **Actions** tab
3. Click the latest workflow run (green checkmark)
4. Scroll down to **Artifacts** section
5. Click **debug-apk** to download the `.apk` file

## Step 5: Install on Android Phone

Once you have the APK:

```bash
# Make sure phone is connected via USB
adb devices

# Install the APK
adb install ~/Downloads/app-debug.apk

# Or drag-drop the APK into Android Studio, or use manual APK installer
```

## What Happens Next?

- **Automatic builds**: Every time you push code to GitHub, the APK rebuilds automatically
- **Continuous testing**: Test features on your phone from the built APK
- **Release builds**: Update workflow to build release APK when you tag versions

---

## Authentication (If Needed)

If GitHub asks for authentication:

1. **Generate Personal Access Token**:
   - Go to https://github.com/settings/tokens
   - Click "Generate new token (classic)"
   - Select scopes: `repo`, `workflow`, `admin:repo_hook`
   - Copy token

2. **Use with git**:
   ```bash
   git remote set-url origin https://YOUR_USERNAME:YOUR_TOKEN@github.com/YOUR_USERNAME/mysportmanager-flutter.git
   git push -u origin main
   ```

3. Or use **SSH** (recommended):
   - Generate SSH key: `ssh-keygen -t ed25519 -C "your-email@example.com"`
   - Add to GitHub: https://github.com/settings/keys
   - Use SSH URL: `git@github.com:YOUR_USERNAME/mysportmanager-flutter.git`

---

## Quick Command (All-in-One)

```bash
cd /mnt/ssd_data/mysportmanager-shared
git remote add origin https://github.com/YOUR_USERNAME/mysportmanager-flutter.git
git branch -M main
git push -u origin main
```

Then check GitHub Actions for automated build!
