Skip to content

Commit

Permalink
Merge branch 'develop' into feature/phpstan-2
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher authored Dec 31, 2024
2 parents 64d9741 + c261487 commit 55db83a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,36 @@ must include both the major and minor version (e.g., `6.7`). For example:
```sh
npx wp-scripts packages-update --dist-tag=wp-6.7`
```
<!--/front-end-->

## Releasing the Plugin

The plugin uses a [built release workflow](./.github/workflows/built-release.yml)
to compile and tag releases. Whenever a new version is detected in the root
`composer.json` file or in the plugin's headers, the workflow will automatically
build the plugin and tag it with a new version. The built tag will contain all
the required front-end assets the plugin may require. This works well for
publishing to WordPress.org or for submodule-ing.
The plugin uses
[action-release](https://github.com/alleyinteractive/action-release) via a
[built release workflow](./.github/workflows/built-release.yml) to compile and
tag releases. Whenever a new version is detected in the root plugin's headers in
the `plugin.php` file or in the `composer.json` file, the workflow will
automatically build the plugin and tag it with a new version. The built tag will
contain all the required front-end assets the plugin may require. This works
well for publishing to WordPress.org or for submodule-ing.

When you are ready to release a new version of the plugin, you can run
`npm run release` to start the process of setting up a new release.
`npm run release`/`composer release` to start the process of setting up a new
release. If you want to do this manually you can follow these steps:

1. Change the `Version` in the `plugin.php` file to a new higher-level version.

```diff
- * Version: 0.0.0
+ * Version: 0.0.1
```

**✨ `npm run release` will do this for you automatically.**

2. Commit your changes and push to the repository.
3. Check the actions tab in the repository to see the progress of the release.
The action will automatically create a new tag and release for the plugin.
You are done!

## Changelog

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"scripts": {
"phpcbf": "phpcbf .",
"phpcs": "phpcs .",
"phpunit": "phpunit",
"phpstan": "phpstan --memory-limit=512M",
"lint": [
"@phpcs",
Expand All @@ -58,6 +57,8 @@
"lint:fix": [
"@phpcbf"
],
"phpunit": "phpunit",
"release": "npx @alleyinteractive/create-release@latest",
"test": [
"@phpcs",
"@phpstan",
Expand Down
10 changes: 10 additions & 0 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ function remove_assets_readme( bool $keep_contents, string $file = 'README.md' )
return;
}

if ( ! str_contains( $contents, '<!--front-end-->' ) ) {
echo "Unable to find the front-end assets section in {$file}.\n";
}

if ( ! str_contains( $contents, '<!--/front-end-->' ) ) {
echo "Unable to find the closing front-end assets section in {$file}.\n";
}

if ( $keep_contents ) {
$contents = str_replace( '<!--front-end-->', '', $contents );
$contents = str_replace( '<!--/front-end-->', '', $contents );
Expand Down Expand Up @@ -629,13 +637,15 @@ function enable_sqlite_testing(): void {
'.eslintignore',
'.eslintrc.json',
'.nvmrc',
'.npmrc',
'.stylelintrc.json',
'babel.config.js',
'jest.config.js',
'jsconfig.json',
'package.json',
'package-lock.json',
'tsconfig.json',
'tsconfig.eslint.json',
'entries/',
'blocks/',
'build/',
Expand Down

0 comments on commit 55db83a

Please sign in to comment.