Skip to content

Commit

Permalink
Merge branch 'release/4.0.5' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed May 19, 2023
2 parents a424c21 + 19af9eb commit 7fc7625
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-and-deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ env:
on:
push:
branches:
- v1
- v4
paths:
- 'docs/**'
pull_request:
Expand All @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: true
matrix:
node-version: [14.x]
node-version: [ 14.x ]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
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
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 }}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# ImageOptimize Changelog

## 4.0.5 - 2023.05.19
### Changed
* Automate release generation via GitHub action
* Add versioning to the docs

### Fixed
* Side-step an issue which caused Craft 4.4.x to do unwanted image transform work even when using an external service to do the transforms ([#373](https://github.com/nystudio107/craft-imageoptimize/issues/373)) ([#13018](https://github.com/craftcms/cms/issues/13018))
* Remove the old Craft generated transform that's still sitting in the temp directory ([#380](https://github.com/nystudio107/craft-imageoptimize/pull/380))

## 4.0.4 - 2023.02.09
### Changed
* Use dynamic docker container name & port for the `buildchain`
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-imageoptimize",
"description": "Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like imgix, with zero template changes.",
"type": "craft-plugin",
"version": "4.0.4",
"version": "4.0.5",
"keywords": [
"craft",
"cms",
Expand Down
6 changes: 6 additions & 0 deletions docs/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export default defineConfig({
{text: 'Store', link: 'https://plugins.craftcms.com/image-optimize'},
{text: 'Changelog', link: 'https://nystudio107.com/plugins/imageoptimize/changelog'},
{text: 'Issues', link: 'https://github.com/nystudio107/craft-imageoptimize/issues'},
{
text: 'v4', items: [
{text: 'v4', link: '/'},
{text: 'v3', link: 'https://nystudio107.com/docs/image-optimize/v3/'},
],
},
],
},
});
18 changes: 15 additions & 3 deletions src/ImageOptimize.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,23 @@ protected function installEventHandlers(): void
*/
protected function installAssetEventHandlers(): void
{
// Handler: Assets::EVENT_GET_ASSET_URL
// Use Asset::EVENT_BEFORE_DEFINE_URL if it's available
// ref: https://github.com/craftcms/cms/issues/13018
try {
$ref = new \ReflectionClassConstant(Asset::class, 'EVENT_BEFORE_DEFINE_URL');
} /** @noinspection PhpRedundantCatchClauseInspection */ catch (\ReflectionException) {
$ref = null;
}
$eventName = $ref?->getDeclaringClass()->name === Asset::class
? Asset::EVENT_BEFORE_DEFINE_URL
: Asset::EVENT_DEFINE_URL;
// Handler: Assets::EVENT_DEFINE_URL
Event::on(
Asset::class,
Asset::EVENT_DEFINE_URL,
$eventName,
static function (DefineAssetUrlEvent $event): void {
Craft::debug(
'Asset::EVENT_GET_ASSET_URL',
'Asset::EVENT_DEFINE_URL',
__METHOD__
);
// Return the URL to the asset URL or null to let Craft handle it
Expand Down Expand Up @@ -341,6 +351,8 @@ static function (ImageTransformerOperationEvent $event): void {
$event
);
if ($tempPath) {
// Remove the old Craft generated transform that's still sitting in the temp directory.
@unlink($event->tempPath);
$event->tempPath = $tempPath;
}
}
Expand Down

0 comments on commit 7fc7625

Please sign in to comment.