Skip to content

Commit

Permalink
Merge branch 'release/4.0.1' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Apr 27, 2024
2 parents ecf170c + 1752c4b commit e1605c0
Show file tree
Hide file tree
Showing 24 changed files with 4,175 additions and 1,682 deletions.
1 change: 0 additions & 1 deletion .craftplugin

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/build-and-deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Build and Deploy Docs
env:
DOCS_DEST_DIR: /fastcgi-cache-bust/
DOCS_DEST_DIR: /fastcgi-cache-bust/v4/
on:
push:
branches:
- v1
- v4
paths:
- 'docs/**'
pull_request:
branches:
- v1
- v4
paths:
- 'docs/**'
workflow_dispatch:
Expand All @@ -22,11 +22,11 @@ jobs:
strategy:
fail-fast: true
matrix:
node-version: [ 14.x ]
node-version: [ 20.x ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Expand All @@ -35,7 +35,7 @@ jobs:
- name: rsync deployments
uses: burnett01/[email protected]
with:
switches: -avzr --delete
switches: -avzr
path: ./dist/
remote_path: ${{ secrets.NYS_DOCS_ROOT }}${{ env.DOCS_DEST_DIR }}
remote_host: ${{ secrets.NYS_DEPLOY_REMOTE_HOST }}
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/code-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Code Analysis

on:
pull_request: null
push:
branches:
- develop-v4
workflow_dispatch:
permissions:
contents: read
jobs:
code_analysis:
strategy:
fail-fast: false
matrix:
actions:
- name: 'PHPStan'
run: composer phpstan
- name: 'Coding Standards'
run: composer fix-cs
name: ${{ matrix.actions.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: 'ctype,curl,dom,iconv,imagick,intl,json,mbstring,openssl,pcre,pdo,reflection,spl,zip'
ini-values: post_max_size=256M, max_execution_time=180, memory_limit=512M
tools: composer:v2
- name: Install Composer dependencies
run: composer install --no-interaction --no-ansi --no-progress
- run: ${{ matrix.actions.run }}
21 changes: 21 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create Release
run-name: Create release for ${{ github.event.client_payload.version }}

on:
repository_dispatch:
types:
- craftcms/new-release

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: ncipollo/release-action@v1
with:
body: ${{ github.event.client_payload.notes }}
makeLatest: ${{ github.event.client_payload.latest }}
name: ${{ github.event.client_payload.version }}
prerelease: ${{ github.event.client_payload.prerelease }}
tag: ${{ github.event.client_payload.tag }}
70 changes: 10 additions & 60 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# FastCGI Cache Bust Changelog

## 4.0.1 - 2024.04.26
### Added
* Add `phpstan` and `ecs` code linting
* Add `code-analysis.yaml` GitHub action

### Changed
* Updated docs to use node 20 & a new sitemap plugin
* PHPstan code cleanup
* ECS code cleanup

## 4.0.0 - 2023.01.12
### Changed
* Don't bust the cache if the element being saved is a draft or revision ([#37](https://github.com/nystudio107/craft-fastcgicachebust/issues/37))
Expand All @@ -9,63 +19,3 @@
## 4.0.0-beta.1 - 2022.03.12
### Added
* Initial Craft CMS 4 compatibility

## 1.0.10 - 2022.03.12

### Added
* Added the ability to use environment variables and aliases in the **FastCGI Cache Path** setting ([#9](https://github.com/nystudio107/craft-fastcgicachebust/issues/9))
* Added `.gitattributes` & `CODEOWNERS`

### Changed

* Refactored from `composer.json` `extra` to `__construct()` and object properties
* Switched documentation system to VitePress

## 1.0.9 - 2020.04.16
### Added
* Fixed Asset Bundle namespace case

## 1.0.8 - 2018.04.14
### Added
* The FastCGI Cache will now also be cleared whenever Template caches are deleted

### Changed
* Refactored out to `shouldBustCache` method
* Code cleanup

## 1.0.7 - 2018.03.20
### Changed
* Added a config file override warning to the Settings page
* Fixed inconsistent quotes in the `config.php`

## 1.0.6 - 2018.03.02
### Changed
* Fixed deprecation errors from Craft CMS 3 RC13

## 1.0.5 - 2018.02.01
### Added
* Renamed the composer package name to `craft-fastcgicachebust`

## 1.0.4 - 2017.12.06
### Added
* You can have more than one cache to have it clear by separating the paths with a comma (`,`) in the config settings

### Changed
* Updated to require craftcms/cms `^3.0.0-RC1`

## 1.0.3 - 2017.11.27
### Changed
* Don't bust the FastCGI Cache unless the element being saved is ENABLED or LIVE
* Don't bust the FastCGI Cache for certain custom ElementTypes

## 1.0.2 - 2017.08.12
### Changed
* Added 'FastCGI Cache' to the list of things that can be cleared via Craft's Clear Caches tool

## 1.0.1 - 2017.07.15
### Changed
* Craft 3 beta 20 compatibility

## 1.0.0 - 2017.06.16
### Added
- Initial release
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
The MIT License (MIT)

Copyright (c) 2017 nystudio107
Copyright (c) nystudio107

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/badges/quality-score.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/?branch=v1) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/badges/coverage.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/?branch=v1) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/badges/build.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/build-status/v1) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/badges/code-intelligence.svg?b=v1)](https://scrutinizer-ci.com/code-intelligence)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/badges/quality-score.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/?branch=v4) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/badges/coverage.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/?branch=v4) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/badges/build.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/build-status/v4) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-fastcgicachebust/badges/code-intelligence.svg?b=v4)](https://scrutinizer-ci.com/code-intelligence)

# FastCGI Cache Bust plugin for Craft CMS 4.x

Bust the Nginx FastCGI Cache when entries are saved or created.

![Screenshot](./docs/docs/resources/img/plugin-logo.png)

Related: [FastCGI Cache Bust for Craft 2.x](https://github.com/nystudio107/fastcgicachebust)

## Requirements

This plugin requires Craft CMS 4.0.0 or later.
Expand All @@ -21,8 +19,6 @@ To install FastCGI Cache Bust, follow these steps:

You can also install FastCGI Cache Bust via the **Plugin Store** in the Craft Control Panel.

FastCGI Cache Bust works on Craft 4.x.

## Documentation

Click here -> [FastCGI Cache Bust Documentation](https://nystudio107.com/plugins/fastcgi-cache-bust/documentation)
Expand Down
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-fastcgicachebust",
"description": "Bust the Nginx FastCGI Cache when entries are saved or created.",
"type": "craft-plugin",
"version": "4.0.0",
"version": "4.0.1",
"keywords": [
"craft",
"cms",
Expand All @@ -13,7 +13,7 @@
"support": {
"docs": "https://nystudio107.com/docs/fastcgi-cache-bust/",
"issues": "https://nystudio107.com/plugins/fastcgi-cache-bust/support",
"source": "https://github.com/nystudio107/craft-minify"
"source": "https://github.com/nystudio107/craft-fastcgicachebust"
},
"license": "MIT",
"authors": [
Expand All @@ -25,6 +25,16 @@
"require": {
"craftcms/cms": "^4.0.0"
},
"require-dev": {
"craftcms/ecs": "dev-main",
"craftcms/phpstan": "dev-main",
"craftcms/rector": "dev-main"
},
"scripts": {
"phpstan": "phpstan --ansi --memory-limit=1G",
"check-cs": "ecs check --ansi",
"fix-cs": "ecs check --fix --ansi"
},
"config": {
"allow-plugins": {
"craftcms/plugin-installer": true,
Expand Down
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/vendor
/node_modules
/docs/.vitepress/dist
/docs/.vitepress/cache
6 changes: 4 additions & 2 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG TAG=14-alpine
FROM nystudio107/node-dev-base:$TAG
ARG TAG=20-alpine
FROM node:$TAG

RUN npm install -g npm@^10.0.0

WORKDIR /app/

Expand Down
82 changes: 38 additions & 44 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
TAG?=14-alpine
CONTAINER?=$(shell basename $(dir $(CURDIR)))-docs
DOCKERRUN=docker container run \
--name ${CONTAINER} \
--rm \
-p 3002:3002 \
-t \
-v `pwd`:/app \
${CONTAINER}:${TAG}
DOCSDEST?=../../../sites/nystudio107/web/docs/fastcgi-cache-bust
MAJOR_VERSION?=4
TAG?=20-alpine
CONTAINER?=$(shell basename $(dir $(CURDIR)))-v${MAJOR_VERSION}-docs
DOCS_DEV_PORT?=400${MAJOR_VERSION}
DOCS_DEST?=../../../sites/nystudio107/web/docs/fastcgi-cache-bust/v4
IMAGE_INFO=$(shell docker image inspect $(CONTAINER):$(TAG))
IMAGE_NAME=${CONTAINER}:${TAG}
DOCKER_RUN=docker container run --rm -it -v "${CURDIR}":/app

.PHONY: docker build dev fix install lint clean npm
.PHONY: build clean dev fix image-build image-check lint npm ssh

# Start the Docker container
docker:
docker build \
. \
-t ${CONTAINER}:${TAG} \
--build-arg TAG=${TAG} \
--no-cache
# Build the production docs
build: docker install
${DOCKERRUN} \
run docs:build
rm -rf ${DOCSDEST}
mv ./docs/.vitepress/dist ${DOCSDEST}
# Start up the dev server
dev: docker install
${DOCKERRUN} \
run docs:dev
# Fix the docs via textlint
fix: docker install
${DOCKERRUN} \
run docs:fix
# Run an npm install
install: docker
${DOCKERRUN} \
install
# Lint the docs via textlint
lint: docker install
${DOCKERRUN} \
run docs:lint
# Remove node_modules/* & package-lock.json
# Perform a dist build via npm run docs:build
build: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} run docs:build
rm -rf ${DOCS_DEST}
mv ./docs/.vitepress/dist ${DOCS_DEST}
# Remove node_modules/ & package-lock.json
clean:
rm -rf node_modules/
rm -f package-lock.json
# Run the development server via npm run docs:dev
dev: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ -e DOCS_DEV_PORT="${DOCS_DEV_PORT}" -p ${DOCS_DEV_PORT}:${DOCS_DEV_PORT} ${IMAGE_NAME} run docs:dev
# Fix the docs with textlint via npm run docs:fix
fix: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} run docs:fix
# Build the Docker image & run npm install
image-build:
docker build . -t ${IMAGE_NAME} --build-arg TAG=${TAG} --no-cache
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} install
# Ensure the image has been created
image-check:
ifeq ($(IMAGE_INFO), [])
image-check: image-build
endif
# Lint the docs with textlint via npm run docs:lint
lint: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} run docs:lint
# Run the passed in npm command
npm: docker
${DOCKERRUN} \
$(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS)
npm: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS)
# Open a shell inside of the container
ssh: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ --entrypoint=/bin/sh ${IMAGE_NAME}
%:
@:
# ref: https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line
Loading

0 comments on commit e1605c0

Please sign in to comment.