# Everlytic WooCommerce Plugin — Release Process

## Overview

Releases are deployed automatically to WordPress.org via a GitHub Actions workflow (`.github/workflows/main.yml`). The workflow uses the `10up/action-wordpress-plugin-deploy` action to push to the WordPress.org SVN repository.

**Important:** Pushing a git tag alone does NOT trigger the deployment. You must publish a GitHub Release.

---

## Publishing a New Release

### 1. Update the version number

Before tagging, ensure the version is bumped in:
- `index.php` — the `Version:` header in the plugin file comment block
- `README.txt` — the `Stable tag:` field (set it to `RELEASE_TAG`; the workflow substitutes the actual tag value at deploy time)

### 2. Push your tag

```bash
git tag vX.Y.Z
git push origin vX.Y.Z
```

Replace `vX.Y.Z` with your version number (e.g. `v1.9.0`).

### 3. Create a GitHub Release

1. Go to the repository on GitHub
2. Navigate to **Releases** → **Create a new release** (or **Draft a new release**)
3. Select your tag from the **Choose a tag** dropdown
4. Add a title and release notes
5. Ensure **"Set as a pre-release"** is **unchecked** — pre-releases are excluded by the workflow
6. Click **Publish release**

The workflow triggers on publish and will not run for pre-releases.

---

## Verifying the Deployment

Check these in order after publishing:

### 1. GitHub Actions log (immediate)

Go to the repository → **Actions** tab → find the `Deploy to WordPress.org` run.

The `WordPress Plugin Deploy` step will show the SVN commit output. A successful run includes lines like:
- `Committing files to trunk`
- `Tagging X.Y.Z`

Any failure is visible here first.

### 2. WordPress.org SVN (within minutes)

The SVN tags directory is public. Confirm your new tag appears at:

```
https://plugins.svn.wordpress.org/everlytic/tags/
```

### 3. WordPress.org API (fastest cache-free check)

Query the plugin API directly — the `version` field updates faster than the public page:

```
https://api.wordpress.org/plugins/info/1.0/everlytic.json
```

### 4. WordPress.org plugin page (up to a few hours)

The public listing caches metadata and may lag. Once the cache clears, the **Version** and **Last updated** fields should reflect the new release:

```
https://wordpress.org/plugins/everlytic/
```

---

## Prerequisites

The workflow requires two GitHub repository secrets to be configured:

| Secret | Description |
|---|---|
| `SVN_USERNAME` | WordPress.org SVN username |
| `SVN_PASSWORD` | WordPress.org SVN password |

If these are missing or incorrect, the deploy step will fail. Check the Actions log for authentication errors.

---

## Manual Trigger

The workflow can also be triggered manually without creating a release:

1. Go to **Actions** → **Deploy to WordPress.org**
2. Click **Run workflow**
3. Select any branch from the dropdown (only determines which workflow file runs, not what gets deployed)
4. Enter the tag name to build (e.g. `1.8.4`) in the **Tag to Build** field
5. Click **Run workflow**

This is useful for re-running a failed deployment or rolling back to a previous version without re-publishing a GitHub Release.

**Note:** If the version tag already exists in SVN, the action will log `Version X.Y.Z was already published` and skip creating the tag — but it will still update trunk with that version's code and stable tag, making it the active version on WordPress.org.

## Rolling Back a Release

If a version was accidentally published, redeploy the previous stable version using the manual trigger above with the last known good tag. Then verify via the API:

```
https://api.wordpress.org/plugins/info/1.0/everlytic.json
```

The `version` field should reflect the rolled-back version within minutes.

To remove the accidental SVN tag (requires SVN credentials):

```bash
svn delete https://plugins.svn.wordpress.org/everlytic/tags/X.Y.Z \
  -m "Removing accidental release X.Y.Z" \
  --username YOUR_SVN_USER
```
