# CurseForge Automated Upload Setup

This guide will help you set up automated uploads to CurseForge when you create GitHub releases.

## Prerequisites

1. A CurseForge account
2. Your addon project created on CurseForge
3. GitHub repository with admin access

## Step 1: Create CurseForge Project

1. Go to https://www.curseforge.com/
2. Click "Start a Project" → "World of Warcraft"
3. Fill in project details:
   - **Name**: Cursor Effects
   - **Summary**: Enhance your mouse cursor with customizable visual effects
   - **Category**: User Interface
   - **Description**: Copy from README.md
   - **Icon**: Upload `icon.png`
4. Submit for approval (usually takes a few hours)
5. Note your **Project ID** from the project URL: `https://www.curseforge.com/wow/addons/cursor-effects`

## Step 2: Get CurseForge API Token

1. Go to https://www.curseforge.com/account/api-tokens
2. Click "Generate Token"
3. Name it: "GitHub Actions - CursorEffects"
4. **Copy the token** (you won't see it again!)

## Step 3: Add Token to GitHub

1. Go to your GitHub repository: `https://github.com/TheGraele/CursorEffects`
2. Click **Settings** → **Secrets and variables** → **Actions**
3. Click **New repository secret**
4. Name: `CF_API_KEY`
5. Value: Paste your CurseForge API token
6. Click **Add secret**

## Step 4: Update Workflow with Project ID

1. Edit `.github/workflows/release.yml`
2. Replace `1234567` in the `-p` argument with your actual CurseForge Project ID
3. Commit and push the change

## Step 5: Test the Workflow

### Option 1: Create a New Release
```bash
git tag v1.0.2
git push origin v1.0.2
gh release create v1.0.2 --title "v1.0.2" --notes "Test release"
```

### Option 2: Manual Trigger
1. Go to **Actions** tab in GitHub
2. Click **Release to CurseForge**
3. Click **Run workflow**
4. Select branch: `main`
5. Click **Run workflow**

## How It Works

When you create a new GitHub release:
1. GitHub Actions triggers automatically
2. Packager creates a clean addon zip (excludes dev files)
3. Changelog from `CHANGELOG.md` is extracted
4. Zip is uploaded to CurseForge with version info
5. Release appears on your CurseForge project page

## Updating the Changelog

Before each release, update `CHANGELOG.md`:

```markdown
## v1.0.2 - YYYY-MM-DD

### New Features
- Feature description

### Bug Fixes
- Fix description
```

The packager automatically extracts the latest version section for CurseForge.

## Troubleshooting

### Upload fails with "Invalid API key"
- Verify the `CF_API_KEY` secret is set correctly in GitHub
- Check the API token hasn't expired on CurseForge

### Upload succeeds but file not on CurseForge
- Your project may still be pending approval
- Check CurseForge project dashboard for status

### Wrong Project ID
- Find your project ID in the CurseForge URL or project dashboard
- Update the `-p` value in `release.yml`

## Files Created

- `.github/workflows/release.yml` - GitHub Actions workflow
- `.pkgmeta` - Packager configuration (file exclusions)
- `CHANGELOG.md` - Version history for CurseForge releases

## Additional Options

### Also upload to WoWInterface

Add to `release.yml` environment:
```yaml
env:
  CF_API_KEY: ${{ secrets.CF_API_KEY }}
  WOWI_API_TOKEN: ${{ secrets.WOWI_API_TOKEN }}
  GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
```

And update the args:
```yaml
args: -p 1234567 -w 12345
```

Where `12345` is your WoWInterface addon ID.

## Resources

- [BigWigsMods Packager Docs](https://github.com/BigWigsMods/packager)
- [CurseForge API Docs](https://support.curseforge.com/en/support/solutions/articles/9000197321)
- [GitHub Actions Docs](https://docs.github.com/en/actions)
