Skip to content

Commit

Permalink
Merge pull request #2934 from Parsely/develop
Browse files Browse the repository at this point in the history
Release wp-parsely 3.17.0
  • Loading branch information
vaurdan authored Nov 12, 2024
2 parents 9a40103 + eec68a0 commit 0a7b942
Show file tree
Hide file tree
Showing 264 changed files with 25,940 additions and 23,035 deletions.
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@
}
],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/prefer-nullish-coalescing": ["error"],
"@typescript-eslint/method-signature-style": "error", // Can be removed after we've updated to wp-scripts v28 or greater.
"@typescript-eslint/prefer-nullish-coalescing": "error",
// Enabling TS rule and disabling Base rule as it can report incorrect errors.
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-shadow": "error",
// Allow usage of Gutenberg experimental components.
"@wordpress/no-unsafe-wp-apis": "off",
// Allow link tag in JSDocs.
Expand Down
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.
86 changes: 86 additions & 0 deletions .github/workflows/build-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build wp-parsely
on:
push:
branches:
- trunk
- develop
- temp-testing-branch
workflow_dispatch:
env:
SOURCE_REF: ${{ github.ref_name }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build:
name: Build and Commit
runs-on: ubuntu-latest
steps:
- name: Setup BUILT_BRANCH env
run: echo "BUILT_BRANCH=${SOURCE_REF}-built" >> $GITHUB_ENV

- 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 the specific branch/ref
uses: actions/checkout@v4
with:
ref: ${{ env.SOURCE_REF }}
fetch-depth: 0

- name: Fetch and checkout built branch
run: |
if git ls-remote --exit-code origin "${BUILT_BRANCH}"; then
git fetch origin "${BUILT_BRANCH}"
git checkout "${BUILT_BRANCH}"
git pull origin "${BUILT_BRANCH}"
else
git checkout --orphan "${BUILT_BRANCH}" "${SOURCE_REF}"
git commit --allow-empty -m "Create ${BUILT_BRANCH} branch"
fi
- name: Merge current branch into built
run: |
git merge "${SOURCE_REF}" --strategy-option theirs --no-edit --squash --allow-unrelated-histories
- name: Read .nvmrc
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Build
run: |
npm ci
npm run build
composer install --no-dev --optimize-autoloader --classmap-authoritative
- name: Get list of changed files
run: git status -s

- name: Create Commit Message
run: |
# Get the short SHA of the commit
COMMIT_SHA=${GITHUB_SHA::7}
# Retrieve the original commit message and replace newlines with spaces
ORIGINAL_COMMIT_MESSAGE=$(git log -1 --pretty=%B "${GITHUB_SHA}" | tr '\n' ' ' | awk '{$1=$1; sub(/^ +| +$/,"")}1')
# Construct the commit message safely using printf
printf "Build \"%s\" (%s)\n" "$ORIGINAL_COMMIT_MESSAGE" "$COMMIT_SHA" > final_commit_message.txt
- name: Commit built files
run: |
# Add the built files
git add -Af vendor/ build/
git status -s
# Commit the changes using the commit message file
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
123 changes: 123 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Bump wp-parsely version
run-name: Bump wp-parsely version to ${{ github.event.inputs.new_version }}

on:
workflow_dispatch:
inputs:
new_version:
description: 'The new plugin version'
required: true
type: string

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

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

steps:
- 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: |
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/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
run: |
npm ci
npm run build
composer dump-autoload --classmap-authoritative
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
Expand Down
25 changes: 17 additions & 8 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: End-to-end (e2e) Tests
name: End-to-end Tests

on:
# Run on all pull requests.
pull_request:
push:
branches:
- trunk
workflow_call:

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
Expand All @@ -16,37 +17,45 @@ concurrency:

jobs:
test:
name: e2e against WordPress latest
runs-on: ubuntu-20.04
name: E2E against WordPress latest
runs-on: ubuntu-24.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Refresh Composer autoload files
run: composer dump-autoload --classmap-authoritative

- name: Use desired version of NodeJS
uses: actions/setup-node@v4.0.2
uses: actions/setup-node@v4.1.0
with:
node-version: 16
node-version: 18
cache: npm

- name: Npm install
run: |
npm ci
- name: Install Playwright dependencies
run: |
npx playwright install chromium --with-deps
- name: Start up WordPress environment
run: |
npm run dev:start
- name: Running the tests
- name: Running E2E tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
npm run test:e2e -- --listTests > ~/.jest-e2e-tests
npm run test:e2e
- name: Stop WordPress environment
run: |
npm run dev:stop
- name: Archive e2e results
- name: Archive E2E results
uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
Loading

0 comments on commit 0a7b942

Please sign in to comment.