From 8fa3b7ac1270ecbbc9500e774b743aa8fc63d932 Mon Sep 17 00:00:00 2001 From: Just Jam Date: Mon, 15 Sep 2025 14:33:38 +0100 Subject: [PATCH 1/2] Fix error where current Docker version is not found (#166) --- config.schema.json | 4 ++-- src/index.ts | 5 +---- src/ui-api.ts | 29 +++++++++++++++++------------ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/config.schema.json b/config.schema.json index 6d88751..72415f8 100644 --- a/config.schema.json +++ b/config.schema.json @@ -105,14 +105,14 @@ }, "autoUpdateHomebridgeUI": { "title": "Auto-update Homebridge Config UI", - "type": "boolean", + "type": "boolean", "description": "Automatically install Homebridge Config UI updates when available (requires homebridge-config-ui-x and sufficient npm privileges)", "default": false }, "autoUpdatePlugins": { "title": "Auto-update plugins", "type": "boolean", - "description": "Automatically install plugin updates when available (requires homebridge-config-ui-x and sufficient npm privileges)", + "description": "Automatically install plugin updates when available (requires homebridge-config-ui-x and sufficient npm privileges)", "default": false }, "allowDirectNpmUpdates": { diff --git a/src/index.ts b/src/index.ts index 6b6d8fd..4867c48 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,6 +35,7 @@ import { InstalledPlugin, UiApi } from './ui-api.js' // ESM equivalent of __dirname const __filename = fileURLToPath(import.meta.url) +// eslint-disable-next-line unused-imports/no-unused-vars const __dirname = path.dirname(__filename) let hap: HAP @@ -162,10 +163,6 @@ class PluginUpdatePlatform implements DynamicPlatformPlugin { ) } - - - - async checkUi(): Promise { this.log.debug('Searching for available updates ...') diff --git a/src/ui-api.ts b/src/ui-api.ts index 3e38a9a..a957d7c 100644 --- a/src/ui-api.ts +++ b/src/ui-api.ts @@ -56,7 +56,8 @@ export class UiApi { axiosRetry(axios, { retries: 3, retryDelay: (...arg) => axiosRetry.exponentialDelay(...arg, 1000), - + + // eslint-disable-next-line unused-imports/no-unused-vars onRetry: (retryCount, error, _requestConfig) => { this.log.debug(`retry count: ${retryCount}, error: ${error.message}`) }, @@ -128,20 +129,24 @@ export class UiApi { if (this.isConfigured() && currentDockerVersion !== undefined) { const json = await this.makeDockerCall('/v2/repositories/homebridge/homebridge/tags/?page_size=30&page=1&ordering=last_updated') - const versions = json.results as any[] - - const installedVersion = versions.filter(version => version.name === currentDockerVersion)[0] - const installedVersionDate = Date.parse(installedVersion.last_updated) - - const availableVersions = versions.filter(version => - !(version.name as string).includes('beta') && - (Date.parse(version.last_updated) > installedVersionDate), + const images = json.results as any[] + + // If the currently installed version is not returned in the list of Docker versions (too old or deleted), + // then use a last-updated date Jan 1, 1970 + const installedImage = images.filter(image => image.name === currentDockerVersion)[0] ?? undefined + const installedImageDate = Date.parse(installedImage ? installedImage.last_updated : '1970-01-01T00:00:00.000000Z') + + // Filter for version names YYYY-MM-DD (no alphas or betas) + const regex: RegExp = /^\d{4}-\d{2}-\d{2}$/gm + const availableImages = images.filter(image => + (image.name as string).match(regex) && + (Date.parse(image.last_updated) > installedImageDate), ) - if (availableVersions.length > 0) { + if (availableImages.length > 0) { dockerInfo = { name: 'Docker image', - installedVersion: installedVersion, - latestVersion: availableVersions[0].name, + installedVersion: currentDockerVersion, + latestVersion: availableImages[0].name, updateAvailable: true, } } From b8b47ceedacf45e0ce987d0945c233e4970873d8 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 15 Sep 2025 15:35:34 +0000 Subject: [PATCH 2/2] chore(release): v2.3.4 [skip ci] * Fix error where current Docker version is not found by @justjam2013 in https://github.com/homebridge-plugins/homebridge-plugin-update-check/pull/166 **Full Changelog**: https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.3.3...v2.3.4 --- .github/workflows/beta-release.yml | 55 ++++++++++++++++++++++++ .github/workflows/release.yml | 4 +- CHANGELOG.md | 69 +++--------------------------- package-lock.json | 4 +- package.json | 2 +- 5 files changed, 67 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/beta-release.yml diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml new file mode 100644 index 0000000..5e9648f --- /dev/null +++ b/.github/workflows/beta-release.yml @@ -0,0 +1,55 @@ +name: Beta Release + +on: + push: + branches: [beta-*.*.*, beta] + workflow_dispatch: + +jobs: + build_and_test: + uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@latest + with: + enable_coverage: false + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + lint: + needs: build_and_test + uses: homebridge/.github/.github/workflows/eslint.yml@latest + + publish: + needs: lint + if: ${{ github.repository == 'homebridge-plugins/homebridge-plugin-update-check' }} + permissions: + id-token: write + uses: homebridge/.github/.github/workflows/npm-publish-esm.yml@latest + with: + tag: 'beta' + dynamically_adjust_version: true + npm_version_command: 'pre' + pre_id: 'beta' + secrets: + npm_auth_token: ${{ secrets.npm_token }} + + pre-release: + needs: publish + if: ${{ github.repository == 'homebridge-plugins/homebridge-plugin-update-check' }} + uses: homebridge/.github/.github/workflows/pre-release.yml@latest + with: + npm_version: ${{ needs.publish.outputs.NPM_VERSION }} + body: | + **Beta Release** + **Version**: v${{ needs.publish.outputs.NPM_VERSION }} + [How To Test Beta Releases](https://github.com/homebridge-plugins/homebridge-plugin-update-check/wiki/Beta-Version) + + github-releases-to-discord: + name: Discord Webhooks + needs: [build_and_test,publish] + if: ${{ github.repository == 'homebridge-plugins/homebridge-plugin-update-check' }} + uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest + with: + title: "Air Beta Release" + description: | + Version `v${{ needs.publish.outputs.NPM_VERSION }}` + url: "https://github.com/homebridge-plugins/homebridge-plugin-update-check/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}" + secrets: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_BETA || secrets.DISCORD_WEBHOOK_URL_LATEST }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 827791e..15715eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,8 +3,8 @@ name: Unified Release on: push: branches: - - "alpha-*" - - "beta-*" + #- "alpha-*" + #- "beta-*" - latest workflow_dispatch: diff --git a/CHANGELOG.md b/CHANGELOG.md index d6335fc..28b8406 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,69 +1,14 @@ -## [2.3.3](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.3.2...v2.3.3) (2025-09-14) - - - -## [2.3.2](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.3.1...v2.3.2) (2025-09-13) - - - -## [2.3.1](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.3.0...v2.3.1) (2025-09-04) - - - -# [2.3.0](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.2.1...v2.3.0) (2025-08-18) - - - -## [2.2.1](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.1.0...v2.2.1) (2025-08-17) - - - -# [2.1.0](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.0.2...v2.1.0) (2025-08-09) - - - -## [2.0.2](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.0.1...v2.0.2) (2025-03-05) - - - -## [2.0.1](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.0.0...v2.0.1) (2025-01-26) - - - -## [1.0.2](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v1.0.1...v1.0.2) (2022-03-26) - - - -## [1.0.1](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v1.0.0...v1.0.1) (2022-01-15) - - - -# [1.0.0](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v0.2.1...v1.0.0) (2022-01-15) - - - -## [0.2.1](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v0.2.0...v0.2.1) (2021-02-20) - - - -# [0.2.0](https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v0.1.1...v0.2.0) (2021-02-20) - - - -## 0.1.1 (2021-02-19) +# Changelog +All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/) +## [2.3.4](https://github.com/homebridge-plugins/homebridge-plugin-update-check/releases/tag/v2.3.4) (2025-09-14) +## What's Changed +* Fix error where current Docker version is not found by @justjam2013 in https://github.com/homebridge-plugins/homebridge-plugin-update-check/pull/166 +**Full Changelog**: https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.3.3...v2.3.4 ## [2.3.3](https://github.com/homebridge-plugins/homebridge-plugin-update-check/releases/tag/v2.3.3) (2025-09-14) - -### What's Changed -- v2.3.3 ([948e9c2](https://github.com/homebridge-plugins/homebridge-plugin-update-check/commit/948e9c22d6ad5d040864407a81a8a309228825e4)) - -**Full Changelog**: https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v2.3.2...v2.3.3 - -## [2.3.3](https://github.com/homebridge-plugins/homebridge-plugin-update-check/releases/tag/v2.3.3) (2025-09-14) - ### What's Changed - v2.3.3 ([b7a4c9e](https://github.com/homebridge-plugins/homebridge-plugin-update-check/commit/b7a4c9ec2b079b6f3e51411311573080b281d97c)) @@ -144,4 +89,4 @@ - Homebridge UI is designed to transition you to the new scoped plugin. - Updated to ES Module -**Full Changelog**: https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v1.0.2...v2.0.0 +**Full Changelog**: https://github.com/homebridge-plugins/homebridge-plugin-update-check/compare/v1.0.2...v2.0.0 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 2fb21d2..de8d4e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@homebridge-plugins/homebridge-plugin-update-check", - "version": "2.3.3", + "version": "2.3.4", "lockfileVersion": 3, "requires": true, "packages": { @@ -13597,4 +13597,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 66b77ac..2b69459 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@homebridge-plugins/homebridge-plugin-update-check", "displayName": "Homebridge Plugin Update Check", "type": "module", - "version": "2.3.3", + "version": "2.3.4", "description": "A Homebridge plugin for checking for updates to Homebridge and plugins", "author": "David Maher", "license": "BSD-2-Clause",