# Deploy scripts

## deploy-svn.sh

Syncs the WooCommerce plugin from this Git repo into the WordPress.org SVN working copy, creates a version tag, and commits.

### Prerequisites

- [Subversion](https://subversion.apache.org/) (`svn`)
- `rsync`
- A checked-out SVN working copy at `xmoney-payments` (default: `../xmoney-payments`)

### What gets copied

Files from the repo root are synced into `trunk/` with `rsync --delete`.

**Excluded:**

- `vendor/`
- `tests/`
- `.git/`, `.svn/`, `.DS_Store`, `*.swp`

Everything else in the plugin directory (including `phpunit.xml`, `LICENSE`, assets, etc.) is included.

### Version

The release version is taken from (all must match):

- `Version:` in `class-xmoney-payments.php`
- `Stable tag:` in `readme.txt`
- `XMONEY_PAYMENTS_VERSION` in `class-xmoney-payments.php`

Pass a version as the first argument to override auto-detection, e.g. `./scripts/deploy-svn.sh 1.0.2`.

Tags use the format `X.Y.Z` (no `v` prefix), e.g. `tags/1.0.2`.

### Authentication

By default, the script prompts for the SVN password (username: `xmoneypayments`).

For non-interactive use, set `SVN_PASSWORD` in the environment or in a `.env` file at the repo root (see `.env.example`). Do not commit `.env`.

### Usage

```bash
# Auto-detect version, prompt for password
./scripts/deploy-svn.sh

# Explicit version and commit message
./scripts/deploy-svn.sh 1.0.2 -m "Release 1.0.2: description of changes"

# Preview rsync and planned SVN steps only
./scripts/deploy-svn.sh --dry-run

# Custom paths
SOURCE_DIR=/path/to/WooCommerce SVN_DIR=/path/to/xmoney-payments ./scripts/deploy-svn.sh
```

### Options

| Option | Description |
|--------|-------------|
| `-m`, `--message MSG` | Commit message (default: `Release VERSION`) |
| `--dry-run` | Show rsync and SVN steps without writing or committing |
| `--skip-update` | Skip `svn update` before deploy |
| `-h`, `--help` | Show help |

### Deploy steps (non-dry-run)

1. Sync Git → `trunk/` via rsync
2. `svn update`
3. Fail if `tags/{version}` already exists
4. `svn add --force trunk`
5. `svn copy trunk tags/{version}`
6. `svn commit` with your message

Update `readme.txt` changelog before deploying a new release.
