Skip to content
Merged
68 changes: 68 additions & 0 deletions .github/ISSUE_TEMPLATE/release-template-new.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
name: Release template [NEW]
about: Internally used for new releases
title: Release wp-parsely x.y.z
labels: 'Type: Maintenance'
---

This is an issue for tracking the next `wp-parsely` release. This ticket is to be opened the week before the actual release, so we have enough time to complete all the related tasks.

The actual release of the plugin should be done on Mondays so we can catch the Tuesday WordPress VIP release window.

## Before releasing

**1. Merge all outstanding work**
- [ ] Merge any outstanding PRs due for this release to the target branch (usually `develop`).
- [ ] Verify that all important PRs have an appropriate `Changelog` tag. PRs without a `Changelog` tag won't be added to the changelog.

**2. Conduct additional testing**
We've got automated testing in place and also test under our local development environment during development. For impactful releases we should also:
- [ ] Conduct an additional [smoke test](https://github.com/Parsely/wp-parsely/blob/develop/docs/TESTING.md#manual-smoke-test) under our local development environment.
- [ ] Test under a regular non-local WordPress installation.
- [ ] Test under a real WordPress VIP environment.

**3. Communicate**
- [ ] Inform Parse.ly support of the upcoming release.

The following additional tasks might be needed depending on the release and its impact:
- [ ] Write any needed internal documentation.
- [ ] Write an internal P2 post about the release (to be posted immediately so folks are aware of the release ahead of time).
- [ ] Write a WordPress VIP Lobby post about the release (to be posted immediately to preannounce next week's VIP release - don't forget to get someone to proofread!).
- [ ] Prepare any public documentation (to be posted after the WordPress.org release).

## Release process

**1. Update version numbers and changelog**
- [ ] [Run the Bump wp-parsely version](https://github.com/Parsely/wp-parsely/actions/workflows/bump-version.yml) GitHub Action to update the version numbers in the plugin files. Use the branch you want to release from (usually `develop`).
- [ ] Verify that the generated PR looks correct. You can amend it with new commits if needed.
- [ ] Merge the PR into the target branch (usually `develop`).

**2. Merge develop into trunk**
- [ ] [Create a PR](https://github.com/Parsely/wp-parsely/compare/trunk...develop?quick_pull=1&title=Release+wp-parsely+x.y.z&body=This+PR+merges+the+`develop`+branch+into+the+`trunk`+branch+in+order+to+release+wp-parsely+x.y.z.) that merges the target branch (usually `develop`) into `trunk`, named _Release wp-parsely x.y.z_.
- [ ] Merge the PR into `trunk`.

**3. Create Release and Deploy to WordPress.org**
- [ ] Check if the `develop` and `trunk` branches built successfully. You can check it in the [GitHub Actions](https://github.com/Parsely/wp-parsely/actions/workflows/build-plugin.yml) tab.
- [ ] [Run the Release wp-parsely](https://github.com/Parsely/wp-parsely/actions/workflows/release-plugin.yml) GitHub Action, on the `trunk-built` branch, inputting the new version number, and without selecting Dry run.
- [ ] Check the action logs for any errors. If there are any, fix them and rerun the action.
- [ ] Check the new release on the [GitHub releases page](https://github.com/Parsely/wp-parsely/releases) and verify that it is correct.
- [ ] Verify that the release was successful by checking the [WordPress.org plugin page](https://wordpress.org/plugins/wp-parsely/).

## After releasing

**1. Communicate**
- [ ] If needed, update the public documentation.
- [ ] Inform the concerned Slack channels about the new release, also preannouncing the WordPress VIP release.

**2. Merge trunk back into develop**
- [ ] [Create a PR](https://github.com/Parsely/wp-parsely/compare/develop...trunk?quick_pull=1&title=Merge+trunk+into+develop+after+the+wp-parsely+x.y.z+release&body=This+PR+merges+the+`trunk`+branch+into+the+`develop`+branch+after+the+release+of+wp-parsely+x.y.z.) that merges `trunk` into `develop`, named _Merge trunk into develop after the wp-parsely x.y.z release_.
- [ ] Merge the PR into `develop`.

**3. Manage milestones**
- [ ] Close the current milestone.
- [ ] If needed, open a new milestone for the next release.

**4. Release to other platforms**
- [ ] Update the `vip-go-mu-plugins` submodule to the latest version.
- [ ] Release the plugin for WordPress VIP.
- [ ] Release the plugin for WordPress.com.
1 change: 0 additions & 1 deletion .github/workflows/build-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ jobs:
git commit -F final_commit_message.txt --no-verify
git push origin "${BUILT_BRANCH}"


- name: Clean up commit message files
run: |
rm final_commit_message.txt
112 changes: 108 additions & 4 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Bump wp-parsely version
run-name: Bump wp-parsely version to ${{ github.event.inputs.new_version }}

on:
workflow_dispatch:
Expand All @@ -8,12 +9,115 @@ on:
required: true
type: string

env:
NEW_VERSION: ${{ github.event.inputs.new_version }}

jobs:
display_version:
name: Display New Version
validate_version:
name: Validate the new version
runs-on: ubuntu-latest
outputs:
current_version: ${{ steps.get_current_version.outputs.current_version }}

steps:
- name: Output the new version
- name: Checks if the new version is valid
run: |
if [[ ! ${{ env.NEW_VERSION }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format. Please use the format x.y.z"
exit 1
fi

- name: Setup PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, json

- name: Checkout ${{ github.ref_name }} branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 0

- name: Get the current version
id: get_current_version
run: |
echo "New version: ${{ github.event.inputs.new_version }}"
CURRENT_VERSION=$(grep -E "^ \* Version:" wp-parsely.php | awk '{print $3}')
echo "Current version is $CURRENT_VERSION"
echo "New version is ${{ env.NEW_VERSION }}"

echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV

- name: Check if the new version is greater than the current version
run: |
php -r '
$current = "${{ env.CURRENT_VERSION }}";
$new = "${{ env.NEW_VERSION }}";
if ( version_compare( $new, $current, "==" ) ) {
echo "The new version (${new}) is the same as the current version (${current}).\n";
exit( 1 );
}
if ( ! version_compare( $new, $current, ">" ) ) {
echo "The new version (${new}) must be greater than the current version (${current}).\n";
exit( 1 );
}
echo "The new version is greater.\n";
'

run_release_php_script:
name: Bump the version and create the PR
needs: validate_version
runs-on: ubuntu-latest
env:
CURRENT_VERSION: ${{ needs.validate_version.outputs.current_version }}
GH_TOKEN: ${{ github.token }}
steps:
- name: Setup PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, json

- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'

- name: Checkout ${{ github.ref_name }} branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 0

- name: Install Composer dependencies
run: composer install --optimize-autoloader --classmap-authoritative

- name: Run bin/release.php script
run: |
echo "Running 'php bin/release.php ${{ env.CURRENT_VERSION }} ${{ env.NEW_VERSION }}'"
echo "n" | php bin/release.php ${{ env.CURRENT_VERSION }} ${{ env.NEW_VERSION }}
if [ $? -ne 0 ]; then
echo "Failed to run the release script"
exit 1
fi
git push --set-upstream origin update/wp-parsely-version-to-${{ env.NEW_VERSION }}

- name: Format the version changelog
run: |
PARSELY_RELEASE_LOG=$(printf '%s' "$PARSELY_RELEASE_LOG" | sed 's/###/##/g')
echo $PARSELY_RELEASE_LOG
# Write the multiline variable to $GITHUB_ENV using the correct syntax
echo "PARSELY_RELEASE_LOG<<EOF" >> $GITHUB_ENV
echo "$PARSELY_RELEASE_LOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create PR
run: |
gh pr create \
--title "Update version number and changelog for ${{ env.NEW_VERSION }} release" \
--body "This PR updates the plugin's version number and changelog in preparation for the ${{ env.NEW_VERSION }} release.

$PARSELY_RELEASE_LOG" \
--base ${{ github.ref_name }} \
--head update/wp-parsely-version-to-${{ env.NEW_VERSION }} \
--assignee ${{ github.actor }}
1 change: 1 addition & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- trunk
workflow_call:

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
paths-ignore:
- '**.md'
pull_request:
workflow_call:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
Expand Down
Loading