-
Notifications
You must be signed in to change notification settings - Fork 31
v4.0.0 #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4.0.0 #330
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,78 @@ | ||
| name: Unified Release | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| #- "alpha-*" | ||
| #- "beta-*" | ||
| - latest | ||
| - 'beta-*' | ||
| - 'beta' | ||
| - 'latest' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| # ─── BETA RELEASE (branches starting with "beta") ──────────────────────────── | ||
|
|
||
| # 1️⃣ Build and test | ||
| build_and_test: | ||
| if: startsWith(github.ref_name, 'beta') | ||
| uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@latest | ||
|
||
| with: | ||
| enable_coverage: false | ||
| secrets: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # 2️⃣ Lint | ||
| lint: | ||
| if: startsWith(github.ref_name, 'beta') | ||
| needs: build_and_test | ||
| uses: homebridge/.github/.github/workflows/eslint.yml@latest | ||
|
||
|
|
||
| # 3️⃣ Publish beta to NPM (OIDC — id-token required here and in the reusable workflow) | ||
| beta-publish: | ||
| if: startsWith(github.ref_name, 'beta') | ||
| needs: lint | ||
| permissions: | ||
| id-token: write | ||
| uses: homebridge/.github/.github/workflows/npm-publish-esm-oidc.yml@latest | ||
|
||
| with: | ||
| tag: 'beta' | ||
| dynamically_adjust_version: true | ||
| npm_version_command: 'pre' | ||
| pre_id: 'beta' | ||
|
|
||
| # 4️⃣ Create GitHub pre-release | ||
| beta-pre-release: | ||
| if: startsWith(github.ref_name, 'beta') | ||
| needs: beta-publish | ||
| uses: homebridge/.github/.github/workflows/pre-release.yml@latest | ||
|
||
| with: | ||
| npm_version: ${{ needs.beta-publish.outputs.NPM_VERSION }} | ||
| body: | | ||
| **Beta Release** | ||
| **Version**: v${{ needs.beta-publish.outputs.NPM_VERSION }} | ||
| [How To Test Beta Releases](https://github.com/OpenWonderLabs/homebridge-switchbot/wiki/Beta-Version) | ||
|
|
||
|
|
||
| # ─── STABLE RELEASE (branch: "latest") ─────────────────────────────────────── | ||
|
|
||
| # 1️⃣ Determine release type, ESM status, and branch name | ||
| determine-release-type: | ||
| if: github.ref_name == 'latest' | ||
| uses: homebridge/.github/.github/workflows/determine-release-type.yml@latest | ||
| with: | ||
| ref_name: ${{ github.ref_name }} | ||
|
|
||
| # 2️⃣ Update version and changelog using the scripts | ||
| update-version: | ||
| if: github.ref_name == 'latest' | ||
| needs: determine-release-type | ||
| uses: homebridge/.github/.github/workflows/update-version.yml@latest | ||
| with: | ||
| release_type: ${{ needs.determine-release-type.outputs.release_type }} | ||
| is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' }} | ||
|
|
||
| # 3️⃣ Publish to NPM and create GitHub release | ||
| # 3️⃣ Publish to NPM and create GitHub release (OIDC — id-token required here and in the reusable workflow) | ||
| publish-release: | ||
| if: github.ref_name == 'latest' | ||
| needs: [determine-release-type, update-version] | ||
| permissions: | ||
| id-token: write | ||
|
|
@@ -39,33 +87,34 @@ jobs: | |
|
|
||
| # 4️⃣ Promote branch if this is a prerelease (alpha/beta) | ||
| promote-branch: | ||
| if: ${{ github.ref_name == 'latest' && needs.determine-release-type.outputs.release_type != 'latest' && needs.determine-release-type.outputs.release_type != 'skip' }} | ||
| needs: [determine-release-type, publish-release] | ||
| if: ${{ needs.determine-release-type.outputs.release_type != 'latest' && needs.determine-release-type.outputs.release_type != 'skip' }} | ||
| uses: homebridge/.github/.github/workflows/promote-branch.yml@latest | ||
| with: | ||
| branch_name: ${{ needs.determine-release-type.outputs.branch_name }} | ||
| release_type: ${{ needs.determine-release-type.outputs.release_type }} | ||
| is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' }} | ||
|
|
||
| # 5️⃣ Notify if any previous job fails | ||
| # 5️⃣ Notify if any stable-release job fails | ||
| workflow-failure: | ||
| if: ${{ failure() }} | ||
| if: failure() | ||
| needs: [determine-release-type, update-version, publish-release, promote-branch] | ||
| uses: homebridge/.github/.github/workflows/report-failure.yml@latest | ||
| with: | ||
| workflow_name: ${{ github.workflow }} | ||
| job_name: ${{ github.job }} | ||
| run_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
|
|
||
| # 6️⃣ Post to Discord | ||
| github-releases-to-discord: | ||
| name: Discord Webhooks | ||
| needs: [determine-release-type, update-version, publish-release] | ||
| # 6️⃣ Post to Discord (Beta + Stable) | ||
| discord: | ||
| name: Release Notifications | ||
| if: ${{ always() && ((startsWith(github.ref_name, 'beta') && needs.beta-publish.result == 'success') || (github.ref_name == 'latest' && needs.publish-release.result == 'success')) }} | ||
|
||
| needs: [beta-publish, update-version, publish-release] | ||
| uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest | ||
| with: | ||
| title: "Node-SwitchBot Module Release" | ||
| title: ${{ startsWith(github.ref_name, 'beta') && 'SwitchBot-Node Beta Release' || 'SwitchBot-Node Release' }} | ||
| description: | | ||
| Version `v${{ needs.update-version.outputs.version }}` | ||
| url: "https://github.com/OpenWonderLabs/node-switchbot/releases/tag/v${{ needs.update-version.outputs.version }}" | ||
| Version `v${{ startsWith(github.ref_name, 'beta') && needs.beta-publish.outputs.NPM_VERSION || needs.update-version.outputs.version }}` | ||
|
Comment on lines
+115
to
+117
|
||
| url: "https://github.com/OpenWonderLabs/node-switchbot/releases/tag/v${{ startsWith(github.ref_name, 'beta') && needs.beta-publish.outputs.NPM_VERSION || needs.update-version.outputs.version }}" | ||
| secrets: | ||
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doc still recommends using
SwitchBotOpenAPIon Windows, but the PR description states v4 replacesSwitchBotBLE/SwitchBotOpenAPIwith a singleSwitchBotclass (and separately mentionsOpenAPIClient). Update this troubleshooting line to reference the v4 way to do API-only operation (e.g.,SwitchBotwithenableBLE: false) or the lower-levelOpenAPIClient, to avoid pointing readers at a removed/legacy class.