# Deployment Guide

This document describes the workflow for deploying a Plugin update from GitHub to wordpress.org.

## Merge PR's

Merge the applicable Pull Requests that have been submitted and pass all tests to the new version's branch (unless
all work was performed on the new version's branch, in which case this step has already been done).

For example, if a new `1.9.6` update were to comprise of PR's related to specific GitHub Issue numbers, each with their own branch,
it's best to merge them into a new version number branch called `1.9.6`.

## Generate Localization File and Action/Filter Documentation

On your local machine, switch to the new version number branch (for example, `1.9.6`).

Run the `.scripts/build.sh` script, which will:

- Generate the `languages/convertkit.pot` file
- Generate the [ACTIONS-FILTERS.md](ACTIONS-FILTERS.md) file

## Update the Plugin's Version Number

We follow [Semantic Versioning](https://semver.org/).

- In `wp-convertkit.php`, change the Version header to the new version number.
- In `wp-convertkit.php`, change the `CONVERTKIT_PLUGIN_VERSION` constant to the new version number.

## Update the Plugin's readme.txt Changelog

Provide meaningful, verbose updates to the Changelog, in the following format:

```
### x.x.x yyyy-mm-dd
* Added: Text Editor: Quicktag Buttons for inserting ConvertKit Forms and Custom Content
* Fix: Integration: Contact Form 7: If Contact Form 7 Form is mapped to a ConvertKit Form, send the data to ConvertKit if form validation passes but Contact Form 7 could or could not send an email
```

Generic changelog items such as `Fix: Various bugfixes` or `Several edge-case bug fixes` should be avoided.  They don't tell users (or us, as developers)
what took place in this version.

Each line in the changelog should start with `Added` or `Fix`.

## Commit Changes

Commit the updated files to the new version number branch, which should comprise of:

- `languages/convertkit.pot`
- `readme.txt`
- `wp-convertkit.php`
- `ACTIONS-FILTERS.md`

## PR Branch into Main

Submit a PR for the new version number branch into the `main` branch, and merge it.

## Create a New Release

[Create a New Release](https://github.com/ConvertKit/convertkit-wordpress/releases/new), completing the following:

- Choose a tag: Click this button and enter the new version number (e.g. `1.9.6`)
- Release title: The version number (e.g. `1.9.6`)
- Describe this release: The changelog entered in the `readme.txt` file for this new version:

![New Release Screen](/.github/docs/new-release.png?raw=true)

## Publish the Release

When you're happy with the above, click `Publish Release`.

This will then trigger the [deploy.yml](.github/workflows/deploy.yml) workflow, which will upload this new version to the wordpress.org repository.

The release will also be available to view on the [Releases](https://github.com/ConvertKit/convertkit-wordpress/releases) section of this GitHub repository.