Skip to content

Commit

Permalink
Merge pull request #267 from pantheon-systems/asset-only-release-1.5
Browse files Browse the repository at this point in the history
Asset only release 1.5.0
  • Loading branch information
jazzsequence authored Mar 26, 2024
2 parents d33775f + 6e0acbc commit faa6c47
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 19 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build-tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =~ ^\.github/ ]] && [[ "$file" != "readme.txt" ]] && [[ $file != "readme.md" ]]; 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:
Expand All @@ -18,3 +53,4 @@ jobs:
uses: pantheon-systems/plugin-release-actions/build-tag-release@main
with:
gh_token: ${{ github.token }}
readme_md: README.md
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
/**
Expand Down Expand Up @@ -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

Expand Down
30 changes: 14 additions & 16 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,20 @@ 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:

```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' );
```
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.
*
* @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.

Expand Down

0 comments on commit faa6c47

Please sign in to comment.