From c84fdd0587f67494373e01da77f544de9fe7d642 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Mon, 11 Mar 2024 15:09:32 -0600 Subject: [PATCH 1/6] update release.md in workflow --- .github/workflows/build-tag-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-tag-release.yml b/.github/workflows/build-tag-release.yml index 4110c99a..4e869eb1 100644 --- a/.github/workflows/build-tag-release.yml +++ b/.github/workflows/build-tag-release.yml @@ -18,3 +18,4 @@ jobs: uses: pantheon-systems/plugin-release-actions/build-tag-release@main with: gh_token: ${{ github.token }} + readme_md: README.md From fa91256ac5aeac021d9c5e22932464b4923b6ab7 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 26 Mar 2024 13:06:40 -0600 Subject: [PATCH 2/6] [CMSP-964] fix readme formatting (#264) * fix readme formatting * make tag conditional on whether affected files were only assets * add names for prettiness * allow case insensitive matching * add readme.md and .github to exclusions * change run-plugin-update to is-asset-update for more clarity --- .github/workflows/build-tag-release.yml | 35 +++++++++++++++++++++++++ readme.txt | 26 +++++++++--------- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-tag-release.yml b/.github/workflows/build-tag-release.yml index 4c377391..ac5bf99f 100644 --- a/.github/workflows/build-tag-release.yml +++ b/.github/workflows/build-tag-release.yml @@ -9,7 +9,42 @@ permissions: contents: write jobs: + check-status: + name: Check Status + runs-on: ubuntu-latest + outputs: + is-asset-update: ${{ steps.set-outputs.outputs.is-asset-update }} + steps: + - uses: actions/checkout@v4 + - id: get-changed-files + uses: jitterbit/get-changed-files@v1 + - id: set-outputs + run: | + echo "Changed files: ${{ steps.get-changed-files.outputs.all }}" + shopt -s nocasematch + run_plugin_update="true" + for file in ${{ steps.get-changed-files.outputs.all }}; do + if [[ ! "$file" =~ ^\.wordpress\.org/ ]] && [[ "$file" != "readme.txt" ]] && [[ $file != "readme.md" ]] && [[ $file =~ ^\.github/ ]]; then + run_plugin_update="false" + break + fi + done + echo "::set-output name=is-asset-update::$run_plugin_update" + asset-only: + name: WP.org Asset Only Update + needs: check-status + if: ${{ needs.check-status.outputs.is-asset-update == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: WP.org Asset Only Update + uses: 10up/action-wordpress-plugin-asset-update@stable + env: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} tag: + needs: check-status + if: ${{ needs.check-status.outputs.is-asset-update == 'false' }} name: Create Tag and Draft Release runs-on: ubuntu-latest steps: diff --git a/readme.txt b/readme.txt index 44d6b36f..6bb1e4f1 100644 --- a/readme.txt +++ b/readme.txt @@ -135,20 +135,18 @@ Need a bit more power? In addition to `pantheon_wp_clear_edge_keys()`, there are By default, Pantheon Advanced Page Cache is pretty aggressive in how it clears its surrogate keys. Specifically, any time `wp_insert_post` is called (which can include any time a post of any type is added or updated, even private post types), it will purge a variety of keys including `home`, `front`, `404` and `feed`. To bypass or override this behavior, since 1.5.0 we have a filter allowing an array of post types to ignore to be passed before those caches are purged. By default, the `revision` post type is ignored, but others can be added: -```php -/** - * Add a custom post type to the ignored post types. - * - * @param array $ignored_post_types The array of ignored post types. - * @return array - */ -function filter_ignored_posts( $ignored_post_types ) { - $ignored_post_types[] = 'my-post-type'; // Ignore my-post-type from cache purges. - return $ignored_post_types; -} - -add_filter( 'pantheon_purge_post_type_ignored', 'filter_ignored_posts' ); -``` + /** + * Add a custom post type to the ignored post types. + * + * @param array $ignored_post_types The array of ignored post types. + * @return array + */ + function filter_ignored_posts( $ignored_post_types ) { + $ignored_post_types[] = 'my-post-type'; // Ignore my-post-type from cache purges. + return $ignored_post_types; + } + + add_filter( 'pantheon_purge_post_type_ignored', 'filter_ignored_posts' ); This will prevent the cache from being purged if the given post type is updated. From d98c1a3f2b19d863c3a6062ebf145c74f5fb0589 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 26 Mar 2024 13:06:40 -0600 Subject: [PATCH 3/6] [CMSP-964] fix readme formatting (#264) * fix readme formatting * make tag conditional on whether affected files were only assets * add names for prettiness * allow case insensitive matching * add readme.md and .github to exclusions * change run-plugin-update to is-asset-update for more clarity --- .github/workflows/build-tag-release.yml | 35 +++++++++++++++++++++++++ readme.txt | 26 +++++++++--------- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-tag-release.yml b/.github/workflows/build-tag-release.yml index 4e869eb1..b991c47f 100644 --- a/.github/workflows/build-tag-release.yml +++ b/.github/workflows/build-tag-release.yml @@ -9,7 +9,42 @@ permissions: contents: write jobs: + check-status: + name: Check Status + runs-on: ubuntu-latest + outputs: + is-asset-update: ${{ steps.set-outputs.outputs.is-asset-update }} + steps: + - uses: actions/checkout@v4 + - id: get-changed-files + uses: jitterbit/get-changed-files@v1 + - id: set-outputs + run: | + echo "Changed files: ${{ steps.get-changed-files.outputs.all }}" + shopt -s nocasematch + run_plugin_update="true" + for file in ${{ steps.get-changed-files.outputs.all }}; do + if [[ ! "$file" =~ ^\.wordpress\.org/ ]] && [[ "$file" != "readme.txt" ]] && [[ $file != "readme.md" ]] && [[ $file =~ ^\.github/ ]]; then + run_plugin_update="false" + break + fi + done + echo "::set-output name=is-asset-update::$run_plugin_update" + asset-only: + name: WP.org Asset Only Update + needs: check-status + if: ${{ needs.check-status.outputs.is-asset-update == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: WP.org Asset Only Update + uses: 10up/action-wordpress-plugin-asset-update@stable + env: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} tag: + needs: check-status + if: ${{ needs.check-status.outputs.is-asset-update == 'false' }} name: Create Tag and Draft Release runs-on: ubuntu-latest steps: diff --git a/readme.txt b/readme.txt index e33af85d..a06f3c8f 100644 --- a/readme.txt +++ b/readme.txt @@ -135,20 +135,18 @@ Need a bit more power? In addition to `pantheon_wp_clear_edge_keys()`, there are By default, Pantheon Advanced Page Cache is pretty aggressive in how it clears its surrogate keys. Specifically, any time `wp_insert_post` is called (which can include any time a post of any type is added or updated, even private post types), it will purge a variety of keys including `home`, `front`, `404` and `feed`. To bypass or override this behavior, since 1.5.0 we have a filter allowing an array of post types to ignore to be passed before those caches are purged. By default, the `revision` post type is ignored, but others can be added: -```php -/** - * Add a custom post type to the ignored post types. - * - * @param array $ignored_post_types The array of ignored post types. - * @return array - */ -function filter_ignored_posts( $ignored_post_types ) { - $ignored_post_types[] = 'my-post-type'; // Ignore my-post-type from cache purges. - return $ignored_post_types; -} - -add_filter( 'pantheon_purge_post_type_ignored', 'filter_ignored_posts' ); -``` + /** + * Add a custom post type to the ignored post types. + * + * @param array $ignored_post_types The array of ignored post types. + * @return array + */ + function filter_ignored_posts( $ignored_post_types ) { + $ignored_post_types[] = 'my-post-type'; // Ignore my-post-type from cache purges. + return $ignored_post_types; + } + + add_filter( 'pantheon_purge_post_type_ignored', 'filter_ignored_posts' ); This will prevent the cache from being purged if the given post type is updated. From 812ad59b0fb00611ff6799b66cdeb9698c07b9d2 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 26 Mar 2024 13:19:01 -0600 Subject: [PATCH 4/6] 1.5.0-dev --- README.md | 6 +++--- package-lock.json | 16 ++++++++-------- package.json | 2 +- pantheon-advanced-page-cache.php | 2 +- readme.txt | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3889fe5f..245bba5e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **Tags:** pantheon, cdn, cache **Requires at least:** 4.7 **Tested up to:** 6.4.3 -**Stable tag:** 1.5.0 +**Stable tag:** 1.5.0-dev **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -142,7 +142,7 @@ Need a bit more power? In addition to `pantheon_wp_clear_edge_keys()`, there are ### Ignoring Specific Post Types ### -By default, Pantheon Advanced Page Cache is pretty aggressive in how it clears its surrogate keys. Specifically, any time `wp_insert_post` is called (which can include any time a post of any type is added or updated, even private post types), it will purge a variety of keys including `home`, `front`, `404` and `feed`. To bypass or override this behavior, since 1.5.0 we have a filter allowing an array of post types to ignore to be passed before those caches are purged. By default, the `revision` post type is ignored, but others can be added: +By default, Pantheon Advanced Page Cache is pretty aggressive in how it clears its surrogate keys. Specifically, any time `wp_insert_post` is called (which can include any time a post of any type is added or updated, even private post types), it will purge a variety of keys including `home`, `front`, `404` and `feed`. To bypass or override this behavior, since 1.5.0-dev we have a filter allowing an array of post types to ignore to be passed before those caches are purged. By default, the `revision` post type is ignored, but others can be added: ```php /** @@ -353,7 +353,7 @@ Pantheon Advanced Page Cache integrates with WordPress plugins, including: See [CONTRIBUTING.md](https://github.com/pantheon-systems/pantheon-advanced-page-cache/blob/master/CONTRIBUTING.md) for information on contributing. ## Changelog ## -### 1.5.0 (March 11, 2024) ### +### 1.5.0-dev (March 11, 2024) ### * Adds filter `pantheon_purge_post_type_ignored` to allow an array of post types to ignore before purging cache [[#258](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/258)] * Adds [wpunit-helpers](https://github.com/pantheon-systems/wpunit-helpers) for running/setting up WP Unit tests diff --git a/package-lock.json b/package-lock.json index 939043b9..719dba16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pantheon-advanced-page-cache", - "version": "1.5.0", + "version": "1.5.0-dev", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pantheon-advanced-page-cache", - "version": "1.5.0", + "version": "1.5.0-dev", "devDependencies": { "grunt": "^1.6.1", "grunt-wp-readme-to-markdown": "~2.1.0" @@ -368,7 +368,7 @@ "exit": "~0.1.2", "findup-sync": "~5.0.0", "glob": "~7.1.6", - "grunt-cli": "~1.5.0", + "grunt-cli": "~1.5.0-dev", "grunt-known-options": "~2.0.0", "grunt-legacy-log": "~3.0.0", "grunt-legacy-util": "~2.0.1", @@ -467,8 +467,8 @@ } }, "node_modules/grunt/node_modules/grunt-cli": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.5.0.tgz", + "version": "1.5.0-dev", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.5.0-dev.tgz", "integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==", "dev": true, "dependencies": { @@ -1392,7 +1392,7 @@ "exit": "~0.1.2", "findup-sync": "~5.0.0", "glob": "~7.1.6", - "grunt-cli": "~1.5.0", + "grunt-cli": "~1.5.0-dev", "grunt-known-options": "~2.0.0", "grunt-legacy-log": "~3.0.0", "grunt-legacy-util": "~2.0.1", @@ -1403,8 +1403,8 @@ }, "dependencies": { "grunt-cli": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.5.0.tgz", + "version": "1.5.0-dev", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.5.0-dev.tgz", "integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==", "dev": true, "requires": { diff --git a/package.json b/package.json index 96a257a5..edd09ecf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pantheon-advanced-page-cache", - "version": "1.5.0", + "version": "1.5.0-dev", "main": "Gruntfile.js", "author": "Pantheon", "devDependencies": { diff --git a/pantheon-advanced-page-cache.php b/pantheon-advanced-page-cache.php index b574ff34..a2c55b76 100644 --- a/pantheon-advanced-page-cache.php +++ b/pantheon-advanced-page-cache.php @@ -7,7 +7,7 @@ * Author URI: https://pantheon.io * Text Domain: pantheon-advanced-page-cache * Domain Path: /languages - * Version: 1.5.0 + * Version: 1.5.0-dev * * @package Pantheon_Advanced_Page_Cache */ diff --git a/readme.txt b/readme.txt index a06f3c8f..4756d87c 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: getpantheon, danielbachhuber, kporras07, jspellman, jazzs3quence, Tags: pantheon, cdn, cache Requires at least: 4.7 Tested up to: 6.4.3 -Stable tag: 1.5.0 +Stable tag: 1.5.0-dev License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -133,7 +133,7 @@ Need a bit more power? In addition to `pantheon_wp_clear_edge_keys()`, there are = Ignoring Specific Post Types = -By default, Pantheon Advanced Page Cache is pretty aggressive in how it clears its surrogate keys. Specifically, any time `wp_insert_post` is called (which can include any time a post of any type is added or updated, even private post types), it will purge a variety of keys including `home`, `front`, `404` and `feed`. To bypass or override this behavior, since 1.5.0 we have a filter allowing an array of post types to ignore to be passed before those caches are purged. By default, the `revision` post type is ignored, but others can be added: +By default, Pantheon Advanced Page Cache is pretty aggressive in how it clears its surrogate keys. Specifically, any time `wp_insert_post` is called (which can include any time a post of any type is added or updated, even private post types), it will purge a variety of keys including `home`, `front`, `404` and `feed`. To bypass or override this behavior, since 1.5.0-dev we have a filter allowing an array of post types to ignore to be passed before those caches are purged. By default, the `revision` post type is ignored, but others can be added: /** * Add a custom post type to the ignored post types. From 28f40fde90a5c27200f49a45d0ffa1848457eb31 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 26 Mar 2024 13:47:57 -0600 Subject: [PATCH 5/6] fix shebang and move the .github folder check (#266) --- .github/workflows/build-tag-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-tag-release.yml b/.github/workflows/build-tag-release.yml index b991c47f..96d5e03f 100644 --- a/.github/workflows/build-tag-release.yml +++ b/.github/workflows/build-tag-release.yml @@ -24,7 +24,7 @@ jobs: shopt -s nocasematch run_plugin_update="true" for file in ${{ steps.get-changed-files.outputs.all }}; do - if [[ ! "$file" =~ ^\.wordpress\.org/ ]] && [[ "$file" != "readme.txt" ]] && [[ $file != "readme.md" ]] && [[ $file =~ ^\.github/ ]]; then + if [[ ! "$file" =~ ^\.wordpress\.org/ ]] && [[ ! $file =~ ^\.github/ ]] && [[ "$file" != "readme.txt" ]] && [[ $file != "readme.md" ]]; then run_plugin_update="false" break fi From 6e0acbc9c746d644e5f6048d663145c48bb34f61 Mon Sep 17 00:00:00 2001 From: Pantheon Automation Date: Tue, 26 Mar 2024 19:48:10 +0000 Subject: [PATCH 6/6] Release 1.5.0 --- package-lock.json | 16 ++++++++-------- package.json | 2 +- pantheon-advanced-page-cache.php | 2 +- readme.txt | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 719dba16..939043b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pantheon-advanced-page-cache", - "version": "1.5.0-dev", + "version": "1.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pantheon-advanced-page-cache", - "version": "1.5.0-dev", + "version": "1.5.0", "devDependencies": { "grunt": "^1.6.1", "grunt-wp-readme-to-markdown": "~2.1.0" @@ -368,7 +368,7 @@ "exit": "~0.1.2", "findup-sync": "~5.0.0", "glob": "~7.1.6", - "grunt-cli": "~1.5.0-dev", + "grunt-cli": "~1.5.0", "grunt-known-options": "~2.0.0", "grunt-legacy-log": "~3.0.0", "grunt-legacy-util": "~2.0.1", @@ -467,8 +467,8 @@ } }, "node_modules/grunt/node_modules/grunt-cli": { - "version": "1.5.0-dev", - "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.5.0-dev.tgz", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.5.0.tgz", "integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==", "dev": true, "dependencies": { @@ -1392,7 +1392,7 @@ "exit": "~0.1.2", "findup-sync": "~5.0.0", "glob": "~7.1.6", - "grunt-cli": "~1.5.0-dev", + "grunt-cli": "~1.5.0", "grunt-known-options": "~2.0.0", "grunt-legacy-log": "~3.0.0", "grunt-legacy-util": "~2.0.1", @@ -1403,8 +1403,8 @@ }, "dependencies": { "grunt-cli": { - "version": "1.5.0-dev", - "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.5.0-dev.tgz", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.5.0.tgz", "integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==", "dev": true, "requires": { diff --git a/package.json b/package.json index edd09ecf..96a257a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pantheon-advanced-page-cache", - "version": "1.5.0-dev", + "version": "1.5.0", "main": "Gruntfile.js", "author": "Pantheon", "devDependencies": { diff --git a/pantheon-advanced-page-cache.php b/pantheon-advanced-page-cache.php index a2c55b76..b574ff34 100644 --- a/pantheon-advanced-page-cache.php +++ b/pantheon-advanced-page-cache.php @@ -7,7 +7,7 @@ * Author URI: https://pantheon.io * Text Domain: pantheon-advanced-page-cache * Domain Path: /languages - * Version: 1.5.0-dev + * Version: 1.5.0 * * @package Pantheon_Advanced_Page_Cache */ diff --git a/readme.txt b/readme.txt index 4756d87c..cf1c1f43 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: getpantheon, danielbachhuber, kporras07, jspellman, jazzs3quence, Tags: pantheon, cdn, cache Requires at least: 4.7 Tested up to: 6.4.3 -Stable tag: 1.5.0-dev +Stable tag: 1.5.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html