# Deployment Guide

## Release Checklist

Before releasing a new version:

- [ ] Update version number in `index.php` (`AIOSRS_PRO_VER` constant and plugin header)
- [ ] Update `package.json` `version` field
- [ ] Add changelog entry in `readme.txt` under `== Changelog ==`
- [ ] Run `npx grunt readme` to regenerate `README.md` from `readme.txt`
- [ ] Run full QA: `composer lint`, `composer phpstan`, `vendor/bin/phpunit`
- [ ] Test on latest WordPress (currently tested up to 6.9)
- [ ] Test PHP compatibility (7.4, 8.0, 8.1, 8.2, 8.3)
- [ ] Test WooCommerce integration if WC-related changes were made
- [ ] Validate schema output via [schema.org validator](https://validator.schema.org/)

---

## Version Files to Update

| File | Location | What to Change |
|---|---|---|
| `index.php` | Plugin header | `Version: x.x.x` |
| `index.php` | `define_constants()` | `AIOSRS_PRO_VER` constant |
| `package.json` | Root | `"version"` field |
| `readme.txt` | Root | `Stable tag: x.x.x` and changelog |
| `README.md` | Root | Auto-generated by `grunt readme` |

---

## Build Process

### 1. Regenerate README.md

```bash
npx grunt readme
```

This converts `readme.txt` (WordPress.org format) to `README.md` (GitHub Markdown format).

### 2. Build Release ZIP

```bash
npx grunt zip
```

Output: `all-in-one-schemaorg-rich-snippets.zip`

The zip includes all plugin files **except**:
- `node_modules/`
- `tests/`
- `.git/`
- `vendor/`
- `bin/`
- `phpstan-baseline.neon`
- `phpstan.neon`
- `stubs-generator.php`

---

## i18n / Translations Workflow

Translations use the text domain `rich-snippets`. Language files are stored in `languages/`.

### Step 1 — Extract strings to .pot

```bash
npm run i18n
```

Runs `grunt i18n` (addtextdomain + makepot) then:
```bash
wp i18n make-pot . --exclude='node_modules,vendor,tests,artifact' languages/all-in-one-schemaorg-rich-snippets.pot --domain=all-in-one-schemaorg-rich-snippets
```

### Step 2 — Update .po files

```bash
npm run i18n:po
```

Updates existing `.po` translation files with new/changed strings from the `.pot`.

### Step 3 — Compile .mo files

```bash
npm run i18n:mo
```

Compiles `.po` → `.mo` (binary format read by WordPress).

### Step 4 — Generate .json for JS

```bash
npm run i18n:json
```

Generates `.json` translation files for JavaScript strings.

### Optional — AI Translation (Dutch)

```bash
npm run i18n:gptpo:nl
```

Uses `gpt-po` to auto-translate the Dutch `.po` file.

---

## WordPress.org Deployment

The plugin is published on WordPress.org under the slug `all-in-one-schemaorg-rich-snippets`.

To release to WordPress.org SVN:
1. Build the release ZIP with `npx grunt zip`
2. Update the SVN trunk and tag directories
3. Commit SVN changes

The `.distignore` file (in the repository root) controls which files are excluded from the WordPress.org SVN commit.

---

## GitHub Release

1. Tag the commit: `git tag -a v1.7.x -m "Version 1.7.x"`
2. Push tag: `git push origin v1.7.x`
3. Create a GitHub Release from the tag
4. Attach the `all-in-one-schemaorg-rich-snippets.zip` built by Grunt

---

## Environment Variables / Secrets

This plugin has no application-level environment variables. The Composer `repositories` in `composer.json` reference private GitHub packages (`brainstormforce/nps-survey`, `brainstormforce/bsf-analytics`) — these require GitHub authentication configured in the local Composer auth file or via `COMPOSER_AUTH` env var in CI.

---

## See Also

- [Environment Configuration](Environment-Configuration)
- [Contributing Guide](Contributing-Guide)
- [Changelog](Changelog)
