@switchbot/homebridge-switchbot 5.0.0-beta.99 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/config.json +14 -0
- package/.github/copilot-instructions.md +39 -0
- package/.github/scripts/normalize-changelog-header.cjs +86 -0
- package/.github/scripts/npm-version-script-esm-auto.js +201 -0
- package/.github/scripts/resolve-version-bump-esm.js +118 -0
- package/.github/workflows/ci.yml +4 -1
- package/.github/workflows/manual-e2e.yml +6 -3
- package/.github/workflows/release.yml +120 -22
- package/.github/workflows/stale.yml +2 -4
- package/.husky/pre-push +15 -0
- package/CHANGELOG.md +133 -137
- package/MIGRATION.md +16 -6
- package/README.md +84 -3
- package/TODO.md +263 -0
- package/config.schema.json +229 -36
- package/dist/SwitchBotHAPPlatform.d.ts +133 -0
- package/dist/SwitchBotHAPPlatform.d.ts.map +1 -0
- package/dist/SwitchBotHAPPlatform.js +555 -0
- package/dist/SwitchBotHAPPlatform.js.map +1 -0
- package/dist/SwitchBotMatterPlatform.d.ts +141 -0
- package/dist/SwitchBotMatterPlatform.d.ts.map +1 -0
- package/dist/SwitchBotMatterPlatform.js +536 -0
- package/dist/SwitchBotMatterPlatform.js.map +1 -0
- package/dist/device-types.d.ts +31 -0
- package/dist/device-types.d.ts.map +1 -0
- package/dist/device-types.js +246 -0
- package/dist/device-types.js.map +1 -0
- package/dist/deviceCommandMapper.d.ts +10 -0
- package/dist/deviceCommandMapper.d.ts.map +1 -0
- package/dist/deviceCommandMapper.js +319 -0
- package/dist/deviceCommandMapper.js.map +1 -0
- package/dist/deviceFactory.d.ts +3 -2
- package/dist/deviceFactory.d.ts.map +1 -1
- package/dist/deviceFactory.js +107 -29
- package/dist/deviceFactory.js.map +1 -1
- package/dist/devices/genericDevice.d.ts +59 -37
- package/dist/devices/genericDevice.d.ts.map +1 -1
- package/dist/devices/genericDevice.js +376 -78
- package/dist/devices/genericDevice.js.map +1 -1
- package/dist/errors.d.ts +38 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +32 -0
- package/dist/errors.js.map +1 -0
- package/dist/homebridge-ui/device-types.js +246 -0
- package/dist/homebridge-ui/device-types.js.map +1 -0
- package/dist/homebridge-ui/deviceCommandMapper.js +319 -0
- package/dist/homebridge-ui/deviceCommandMapper.js.map +1 -0
- package/dist/homebridge-ui/endpoints/config.d.ts +3 -0
- package/dist/homebridge-ui/endpoints/config.d.ts.map +1 -0
- package/dist/homebridge-ui/endpoints/config.js +90 -0
- package/dist/homebridge-ui/endpoints/config.js.map +1 -0
- package/dist/homebridge-ui/endpoints/devices.d.ts +6 -0
- package/dist/homebridge-ui/endpoints/devices.d.ts.map +1 -0
- package/dist/homebridge-ui/endpoints/devices.js +144 -0
- package/dist/homebridge-ui/endpoints/devices.js.map +1 -0
- package/dist/homebridge-ui/endpoints/discovery.d.ts +7 -0
- package/dist/homebridge-ui/endpoints/discovery.d.ts.map +1 -0
- package/dist/homebridge-ui/endpoints/discovery.js +219 -0
- package/dist/homebridge-ui/endpoints/discovery.js.map +1 -0
- package/dist/homebridge-ui/errors.js +32 -0
- package/dist/homebridge-ui/errors.js.map +1 -0
- package/dist/homebridge-ui/homebridge-ui/endpoints/config.js +90 -0
- package/dist/homebridge-ui/homebridge-ui/endpoints/config.js.map +1 -0
- package/dist/homebridge-ui/homebridge-ui/endpoints/devices.js +144 -0
- package/dist/homebridge-ui/homebridge-ui/endpoints/devices.js.map +1 -0
- package/dist/homebridge-ui/homebridge-ui/endpoints/discovery.js +219 -0
- package/dist/homebridge-ui/homebridge-ui/endpoints/discovery.js.map +1 -0
- package/dist/homebridge-ui/homebridge-ui/server.js +11 -0
- package/dist/homebridge-ui/homebridge-ui/server.js.map +1 -0
- package/dist/homebridge-ui/homebridge-ui/utils/config-parser.js +108 -0
- package/dist/homebridge-ui/homebridge-ui/utils/config-parser.js.map +1 -0
- package/dist/homebridge-ui/homebridge-ui/utils/device-migration.js +111 -0
- package/dist/homebridge-ui/homebridge-ui/utils/device-migration.js.map +1 -0
- package/dist/homebridge-ui/homebridge-ui/utils/logger.js +17 -0
- package/dist/homebridge-ui/homebridge-ui/utils/logger.js.map +1 -0
- package/dist/homebridge-ui/public/css/styles.css +483 -0
- package/dist/homebridge-ui/public/index.html +197 -621
- package/dist/homebridge-ui/public/js/advanced-settings.d.ts +3 -0
- package/dist/homebridge-ui/public/js/advanced-settings.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/advanced-settings.js +95 -0
- package/dist/homebridge-ui/public/js/advanced-settings.js.map +1 -0
- package/dist/homebridge-ui/public/js/advanced-settings.ts +94 -0
- package/dist/homebridge-ui/public/js/api.d.ts +67 -0
- package/dist/homebridge-ui/public/js/api.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/api.js +308 -0
- package/dist/homebridge-ui/public/js/api.js.map +1 -0
- package/dist/homebridge-ui/public/js/api.ts +370 -0
- package/dist/homebridge-ui/public/js/app.d.ts +2 -0
- package/dist/homebridge-ui/public/js/app.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/app.js +3723 -0
- package/dist/homebridge-ui/public/js/app.js.map +7 -0
- package/dist/homebridge-ui/public/js/app.ts +22 -0
- package/dist/homebridge-ui/public/js/constants.d.ts +2 -0
- package/dist/homebridge-ui/public/js/constants.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/constants.js +2 -0
- package/dist/homebridge-ui/public/js/constants.js.map +1 -0
- package/dist/homebridge-ui/public/js/constants.ts +1 -0
- package/dist/homebridge-ui/public/js/credentials.d.ts +3 -0
- package/dist/homebridge-ui/public/js/credentials.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/credentials.js +99 -0
- package/dist/homebridge-ui/public/js/credentials.js.map +1 -0
- package/dist/homebridge-ui/public/js/credentials.ts +105 -0
- package/dist/homebridge-ui/public/js/devices-delete.d.ts +3 -0
- package/dist/homebridge-ui/public/js/devices-delete.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/devices-delete.js +199 -0
- package/dist/homebridge-ui/public/js/devices-delete.js.map +1 -0
- package/dist/homebridge-ui/public/js/devices-delete.ts +227 -0
- package/dist/homebridge-ui/public/js/devices.d.ts +9 -0
- package/dist/homebridge-ui/public/js/devices.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/devices.js +98 -0
- package/dist/homebridge-ui/public/js/devices.js.map +1 -0
- package/dist/homebridge-ui/public/js/devices.ts +106 -0
- package/dist/homebridge-ui/public/js/discovery.d.ts +9 -0
- package/dist/homebridge-ui/public/js/discovery.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/discovery.js +1201 -0
- package/dist/homebridge-ui/public/js/discovery.js.map +1 -0
- package/dist/homebridge-ui/public/js/discovery.ts +1335 -0
- package/dist/homebridge-ui/public/js/logger.d.ts +7 -0
- package/dist/homebridge-ui/public/js/logger.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/logger.js +17 -0
- package/dist/homebridge-ui/public/js/logger.js.map +1 -0
- package/dist/homebridge-ui/public/js/logger.ts +17 -0
- package/dist/homebridge-ui/public/js/modal.d.ts +5 -0
- package/dist/homebridge-ui/public/js/modal.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/modal.js +35 -0
- package/dist/homebridge-ui/public/js/modal.js.map +1 -0
- package/dist/homebridge-ui/public/js/modal.ts +35 -0
- package/dist/homebridge-ui/public/js/modals.d.ts +15 -0
- package/dist/homebridge-ui/public/js/modals.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/modals.js +675 -0
- package/dist/homebridge-ui/public/js/modals.js.map +1 -0
- package/dist/homebridge-ui/public/js/modals.ts +765 -0
- package/dist/homebridge-ui/public/js/render.d.ts +71 -0
- package/dist/homebridge-ui/public/js/render.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/render.js +948 -0
- package/dist/homebridge-ui/public/js/render.js.map +1 -0
- package/dist/homebridge-ui/public/js/render.ts +1070 -0
- package/dist/homebridge-ui/public/js/toast.d.ts +6 -0
- package/dist/homebridge-ui/public/js/toast.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/toast.js +37 -0
- package/dist/homebridge-ui/public/js/toast.js.map +1 -0
- package/dist/homebridge-ui/public/js/toast.ts +43 -0
- package/dist/homebridge-ui/public/js/types.d.ts +23 -0
- package/dist/homebridge-ui/public/js/types.d.ts.map +1 -0
- package/dist/homebridge-ui/public/js/types.js +2 -0
- package/dist/homebridge-ui/public/js/types.js.map +1 -0
- package/dist/homebridge-ui/public/js/types.ts +26 -0
- package/dist/homebridge-ui/server.d.ts +1 -3
- package/dist/homebridge-ui/server.d.ts.map +1 -1
- package/dist/homebridge-ui/server.js +8 -471
- package/dist/homebridge-ui/server.js.map +1 -1
- package/dist/homebridge-ui/settings.js +8 -0
- package/dist/homebridge-ui/settings.js.map +1 -0
- package/dist/homebridge-ui/switchbotClient.js +247 -0
- package/dist/homebridge-ui/switchbotClient.js.map +1 -0
- package/dist/homebridge-ui/utils/config-parser.d.ts +39 -0
- package/dist/homebridge-ui/utils/config-parser.d.ts.map +1 -0
- package/dist/homebridge-ui/utils/config-parser.js +108 -0
- package/dist/homebridge-ui/utils/config-parser.js.map +1 -0
- package/dist/homebridge-ui/utils/device-migration.d.ts +35 -0
- package/dist/homebridge-ui/utils/device-migration.d.ts.map +1 -0
- package/dist/homebridge-ui/utils/device-migration.js +111 -0
- package/dist/homebridge-ui/utils/device-migration.js.map +1 -0
- package/dist/homebridge-ui/utils/logger.d.ts +7 -0
- package/dist/homebridge-ui/utils/logger.d.ts.map +1 -0
- package/dist/homebridge-ui/utils/logger.js +17 -0
- package/dist/homebridge-ui/utils/logger.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +1 -0
- package/dist/settings.js.map +1 -1
- package/dist/switchbotClient.d.ts +12 -10
- package/dist/switchbotClient.d.ts.map +1 -1
- package/dist/switchbotClient.js +156 -103
- package/dist/switchbotClient.js.map +1 -1
- package/dist/utils.d.ts +76 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1121 -4
- package/dist/utils.js.map +1 -1
- package/docs/assets/highlight.css +16 -2
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +3 -3
- package/docs/index.html +82 -5
- package/docs/variables/default.html +3 -1
- package/eslint.config.js +9 -5
- package/nodemon.json +2 -2
- package/package.json +35 -22
- package/scripts/build-ui.js +37 -0
- package/scripts/free-dev-ports.mjs +105 -0
- package/scripts/generate-matter-maps.js +34 -17
- package/scripts/sync-device-types.mjs +31 -0
- package/src/SwitchBotHAPPlatform.ts +558 -0
- package/src/SwitchBotMatterPlatform.ts +538 -0
- package/src/device-types.js +246 -0
- package/src/device-types.js.map +1 -0
- package/src/device-types.ts +261 -0
- package/src/deviceCommandMapper.js +319 -0
- package/src/deviceCommandMapper.js.map +1 -0
- package/src/deviceCommandMapper.ts +333 -0
- package/src/deviceFactory.ts +125 -45
- package/src/devices/genericDevice.ts +411 -69
- package/src/errors.js +32 -0
- package/src/errors.js.map +1 -0
- package/src/errors.ts +35 -0
- package/src/homebridge-ui/endpoints/config.ts +110 -0
- package/src/homebridge-ui/endpoints/devices.ts +153 -0
- package/src/homebridge-ui/endpoints/discovery.ts +240 -0
- package/src/homebridge-ui/public/css/styles.css +483 -0
- package/src/homebridge-ui/public/index.html +197 -621
- package/src/homebridge-ui/public/js/advanced-settings.ts +94 -0
- package/src/homebridge-ui/public/js/api.ts +370 -0
- package/src/homebridge-ui/public/js/app.ts +22 -0
- package/src/homebridge-ui/public/js/constants.ts +1 -0
- package/src/homebridge-ui/public/js/credentials.ts +105 -0
- package/src/homebridge-ui/public/js/devices-delete.ts +227 -0
- package/src/homebridge-ui/public/js/devices.ts +106 -0
- package/src/homebridge-ui/public/js/discovery.ts +1335 -0
- package/src/homebridge-ui/public/js/logger.ts +17 -0
- package/src/homebridge-ui/public/js/modal.ts +35 -0
- package/src/homebridge-ui/public/js/modals.ts +765 -0
- package/src/homebridge-ui/public/js/render.ts +1070 -0
- package/src/homebridge-ui/public/js/toast.ts +43 -0
- package/src/homebridge-ui/public/js/types.ts +26 -0
- package/src/homebridge-ui/server.ts +9 -554
- package/src/homebridge-ui/utils/config-parser.ts +125 -0
- package/src/homebridge-ui/utils/device-migration.ts +144 -0
- package/src/homebridge-ui/utils/logger.ts +17 -0
- package/src/index.ts +12 -2
- package/src/settings.js +8 -0
- package/src/settings.js.map +1 -0
- package/src/settings.ts +2 -0
- package/src/switchbotClient.js +247 -0
- package/src/switchbotClient.js.map +1 -0
- package/src/switchbotClient.ts +177 -114
- package/src/utils.ts +1133 -5
- package/test/client/switchbot-client-debounce.spec.ts +35 -0
- package/test/client/switchbot-client-openapi.spec.ts +19 -0
- package/test/client/switchbotClient.spec.ts +64 -0
- package/test/device/device-mapping.spec.ts +23 -0
- package/test/device/deviceBase.spec.ts +26 -0
- package/test/device/deviceFactory-edge.spec.ts +15 -0
- package/test/device/deviceFactory.spec.ts +33 -0
- package/test/device/fan-swing.spec.ts +34 -0
- package/test/device/genericDevice-blepoll.spec.ts +47 -0
- package/test/device/irdevice.spec.ts +9 -0
- package/test/device/lock-users.spec.ts +35 -0
- package/test/device/matter-descriptors.spec.ts +22 -0
- package/test/device/matter-device-state.spec.ts +37 -0
- package/test/e2e/run-e2e.spec.ts +18 -19
- package/test/errors/errors.spec.ts +10 -0
- package/test/helpers/matter-harness.ts +20 -9
- package/test/homebridge-ui/server.spec.ts +9 -0
- package/test/platform/accessory-restore.spec.ts +37 -0
- package/test/platform/matter-childbridge.spec.ts +34 -0
- package/test/platform/matter-integration.spec.ts +33 -0
- package/test/platform/platform-edge.spec.ts +73 -0
- package/test/platform/platform.integration.spec.ts +34 -0
- package/test/utils/utils-extra.spec.ts +10 -0
- package/test/utils/utils.spec.ts +53 -0
- package/todo/TODO.md +80 -0
- package/tsconfig.ui.json +11 -0
- package/.github/npm-version-script-esm.js +0 -97
- package/.github/workflows/beta-release.yml +0 -52
- package/dist/platform.d.ts +0 -35
- package/dist/platform.d.ts.map +0 -1
- package/dist/platform.js +0 -945
- package/dist/platform.js.map +0 -1
- package/src/platform.ts +0 -963
- package/test/accessory-restore.spec.ts +0 -73
- package/test/device-mapping.spec.ts +0 -37
- package/test/deviceFactory.spec.ts +0 -18
- package/test/fan-swing.spec.ts +0 -29
- package/test/lock-users.spec.ts +0 -44
- package/test/matter-childbridge.spec.ts +0 -55
- package/test/matter-descriptors.spec.ts +0 -97
- package/test/matter-device-state.spec.ts +0 -101
- package/test/matter-integration.spec.ts +0 -70
- package/test/platform.integration.spec.ts +0 -55
- package/test/switchbot-client-debounce.spec.ts +0 -131
- package/test/switchbot-client-openapi.spec.ts +0 -56
- package/test/switchbotClient.spec.ts +0 -10
- package/test/utils.spec.ts +0 -20
|
@@ -1,30 +1,124 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Release
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- latest
|
|
6
|
+
- 'beta-*'
|
|
7
|
+
- 'beta'
|
|
8
|
+
- 'latest'
|
|
9
9
|
workflow_dispatch:
|
|
10
|
+
inputs:
|
|
11
|
+
release_type:
|
|
12
|
+
description: Release channel
|
|
13
|
+
required: true
|
|
14
|
+
type: choice
|
|
15
|
+
options:
|
|
16
|
+
- latest
|
|
17
|
+
- beta
|
|
18
|
+
- alpha
|
|
19
|
+
default: latest
|
|
20
|
+
is_esm:
|
|
21
|
+
description: Package is ESM
|
|
22
|
+
required: true
|
|
23
|
+
type: boolean
|
|
24
|
+
default: true
|
|
25
|
+
version_override:
|
|
26
|
+
description: Exact version (for example 2.1.0). Leave empty for auto bump.
|
|
27
|
+
required: false
|
|
28
|
+
type: string
|
|
29
|
+
version_bump:
|
|
30
|
+
description: Auto bump type when version_override is empty
|
|
31
|
+
required: false
|
|
32
|
+
type: choice
|
|
33
|
+
options:
|
|
34
|
+
- patch
|
|
35
|
+
- minor
|
|
36
|
+
- major
|
|
37
|
+
default: patch
|
|
38
|
+
max_attempts:
|
|
39
|
+
description: Max retries for prerelease collision handling
|
|
40
|
+
required: false
|
|
41
|
+
type: number
|
|
42
|
+
default: 5
|
|
43
|
+
|
|
44
|
+
# Cancel any in-progress workflow for the same branch. A new push should
|
|
45
|
+
# supersede the previous run rather than racing it to publish.
|
|
46
|
+
concurrency:
|
|
47
|
+
group: release-${{ github.ref }}
|
|
48
|
+
cancel-in-progress: true
|
|
10
49
|
|
|
11
50
|
jobs:
|
|
12
|
-
#
|
|
51
|
+
# ─── QUALITY GATE (all branches) ────────────────────────────────────────────
|
|
52
|
+
# Build and test run for EVERY push, regardless of branch. Both the beta
|
|
53
|
+
# and stable release paths depend on these passing before anything is
|
|
54
|
+
# published or version-bumped.
|
|
55
|
+
|
|
56
|
+
# 1️⃣ Build and test
|
|
57
|
+
build_and_test:
|
|
58
|
+
uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@latest
|
|
59
|
+
with:
|
|
60
|
+
enable_coverage: false
|
|
61
|
+
secrets:
|
|
62
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
63
|
+
|
|
64
|
+
# 2️⃣ Lint
|
|
65
|
+
lint:
|
|
66
|
+
needs: build_and_test
|
|
67
|
+
uses: homebridge/.github/.github/workflows/eslint.yml@latest
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# ─── BETA RELEASE (branches starting with "beta") ────────────────────────────
|
|
71
|
+
|
|
72
|
+
# 3️⃣ Publish beta to NPM (OIDC — id-token required here and in the reusable workflow)
|
|
73
|
+
beta-publish:
|
|
74
|
+
if: startsWith(github.ref_name, 'beta')
|
|
75
|
+
needs: lint
|
|
76
|
+
permissions:
|
|
77
|
+
id-token: write
|
|
78
|
+
uses: homebridge/.github/.github/workflows/npm-publish-esm-oidc.yml@latest
|
|
79
|
+
with:
|
|
80
|
+
tag: 'beta'
|
|
81
|
+
dynamically_adjust_version: true
|
|
82
|
+
npm_version_command: 'pre'
|
|
83
|
+
pre_id: 'beta'
|
|
84
|
+
|
|
85
|
+
# 4️⃣ Create GitHub pre-release
|
|
86
|
+
beta-pre-release:
|
|
87
|
+
if: startsWith(github.ref_name, 'beta')
|
|
88
|
+
needs: beta-publish
|
|
89
|
+
uses: homebridge/.github/.github/workflows/pre-release.yml@latest
|
|
90
|
+
with:
|
|
91
|
+
npm_version: ${{ needs.beta-publish.outputs.NPM_VERSION }}
|
|
92
|
+
body: |
|
|
93
|
+
**Beta Release**
|
|
94
|
+
**Version**: v${{ needs.beta-publish.outputs.NPM_VERSION }}
|
|
95
|
+
[How To Test Beta Releases](https://github.com/OpenWonderLabs/homebridge-switchbot/wiki/Beta-Version)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
# ─── STABLE RELEASE (branch: "latest") ───────────────────────────────────────
|
|
99
|
+
|
|
100
|
+
# 3️⃣ Determine release type, ESM status, and branch name
|
|
13
101
|
determine-release-type:
|
|
102
|
+
if: github.ref_name == 'latest'
|
|
103
|
+
needs: lint
|
|
14
104
|
uses: homebridge/.github/.github/workflows/determine-release-type.yml@latest
|
|
15
105
|
with:
|
|
16
106
|
ref_name: ${{ github.ref_name }}
|
|
17
107
|
|
|
18
|
-
#
|
|
108
|
+
# 4️⃣ Update version and changelog using the scripts
|
|
19
109
|
update-version:
|
|
110
|
+
if: github.ref_name == 'latest'
|
|
20
111
|
needs: determine-release-type
|
|
21
112
|
uses: homebridge/.github/.github/workflows/update-version.yml@latest
|
|
22
113
|
with:
|
|
23
|
-
release_type: ${{ needs.determine-release-type.outputs.release_type }}
|
|
24
|
-
is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' }}
|
|
114
|
+
release_type: ${{ needs.determine-release-type.outputs.release_type || inputs.release_type }}
|
|
115
|
+
is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' || inputs.is_esm == 'true' }}
|
|
116
|
+
version_override: ${{ inputs.version_override }}
|
|
117
|
+
version_bump: ${{ inputs.version_bump }}
|
|
25
118
|
|
|
26
|
-
#
|
|
119
|
+
# 5️⃣ Publish to NPM and create GitHub release (OIDC — id-token required here and in the reusable workflow)
|
|
27
120
|
publish-release:
|
|
121
|
+
if: github.ref_name == 'latest'
|
|
28
122
|
needs: [determine-release-type, update-version]
|
|
29
123
|
permissions:
|
|
30
124
|
id-token: write
|
|
@@ -34,38 +128,42 @@ jobs:
|
|
|
34
128
|
release_type: ${{ needs.determine-release-type.outputs.release_type }}
|
|
35
129
|
version: ${{ needs.update-version.outputs.version }}
|
|
36
130
|
is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' }}
|
|
131
|
+
#version_override: ${{ inputs.version_override }}
|
|
132
|
+
#version_bump: ${{ inputs.version_bump }}
|
|
133
|
+
#max_attempts: ${{ inputs.max_attempts }}
|
|
37
134
|
secrets:
|
|
38
135
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
39
136
|
|
|
40
|
-
#
|
|
137
|
+
# 6️⃣ Promote branch if this is a prerelease (alpha/beta)
|
|
41
138
|
promote-branch:
|
|
139
|
+
if: ${{ github.ref_name == 'latest' && needs.determine-release-type.outputs.release_type != 'latest' && needs.determine-release-type.outputs.release_type != 'skip' }}
|
|
42
140
|
needs: [determine-release-type, publish-release]
|
|
43
|
-
if: ${{ needs.determine-release-type.outputs.release_type != 'latest' && needs.determine-release-type.outputs.release_type != 'skip' }}
|
|
44
141
|
uses: homebridge/.github/.github/workflows/promote-branch.yml@latest
|
|
45
142
|
with:
|
|
46
143
|
branch_name: ${{ needs.determine-release-type.outputs.branch_name }}
|
|
47
144
|
release_type: ${{ needs.determine-release-type.outputs.release_type }}
|
|
48
|
-
is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' }}
|
|
145
|
+
is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' || inputs.is_esm == 'true' }}
|
|
49
146
|
|
|
50
|
-
#
|
|
147
|
+
# 7️⃣ Notify if any job fails
|
|
51
148
|
workflow-failure:
|
|
52
|
-
if:
|
|
53
|
-
needs: [determine-release-type, update-version, publish-release, promote-branch]
|
|
149
|
+
if: failure()
|
|
150
|
+
needs: [build_and_test, lint, determine-release-type, update-version, publish-release, promote-branch]
|
|
54
151
|
uses: homebridge/.github/.github/workflows/report-failure.yml@latest
|
|
55
152
|
with:
|
|
56
153
|
workflow_name: ${{ github.workflow }}
|
|
57
154
|
job_name: ${{ github.job }}
|
|
58
155
|
run_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
59
156
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
name:
|
|
63
|
-
|
|
157
|
+
# 8️⃣ Post to Discord (Beta + Stable)
|
|
158
|
+
discord:
|
|
159
|
+
name: Release Notifications
|
|
160
|
+
if: ${{ always() && ((startsWith(github.ref_name, 'beta') && needs.beta-publish.result == 'success') || (github.ref_name == 'latest' && needs.publish-release.result == 'success')) }}
|
|
161
|
+
needs: [beta-publish, update-version, publish-release]
|
|
64
162
|
uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
|
|
65
163
|
with:
|
|
66
|
-
title:
|
|
164
|
+
title: ${{ startsWith(github.ref_name, 'beta') && 'Homebridge SwitchBot Beta Release' || 'Homebridge SwitchBot Release' }}
|
|
67
165
|
description: |
|
|
68
|
-
Version `v${{ needs.update-version.outputs.version }}`
|
|
69
|
-
url: "https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v${{ needs.update-version.outputs.version }}"
|
|
166
|
+
Version `v${{ startsWith(github.ref_name, 'beta') && needs.beta-publish.outputs.NPM_VERSION || needs.update-version.outputs.version }}`
|
|
167
|
+
url: "https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v${{ startsWith(github.ref_name, 'beta') && needs.beta-publish.outputs.NPM_VERSION || needs.update-version.outputs.version }}"
|
|
70
168
|
secrets:
|
|
71
169
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }}
|
|
@@ -3,12 +3,10 @@ name: Stale workflow
|
|
|
3
3
|
on:
|
|
4
4
|
workflow_dispatch:
|
|
5
5
|
schedule:
|
|
6
|
-
- cron: '45
|
|
6
|
+
- cron: '45 7 * * *'
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
stale:
|
|
10
|
-
uses:
|
|
11
|
-
with:
|
|
12
|
-
days-before-issue-stale: 15
|
|
10
|
+
uses: homebridge/.github/.github/workflows/stale.yml@latest
|
|
13
11
|
secrets:
|
|
14
12
|
token: ${{ secrets.GITHUB_TOKEN }}
|
package/.husky/pre-push
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
. "$(dirname "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
echo "Running changeset version before push..."
|
|
5
|
+
if npx @changesets/cli version --yes; then
|
|
6
|
+
git add package.json package-lock.json CHANGELOG.md || true
|
|
7
|
+
if ! git diff --staged --quiet; then
|
|
8
|
+
echo "Committing version and changelog updates"
|
|
9
|
+
git commit -m "chore(release): version packages [skip ci]" || true
|
|
10
|
+
else
|
|
11
|
+
echo "No version changes to commit"
|
|
12
|
+
fi
|
|
13
|
+
else
|
|
14
|
+
echo "changeset version failed or no changesets present"
|
|
15
|
+
fi
|