You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a90fb76
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .github/workflows/deploy.yml
+38-23Lines changed: 38 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,14 @@
1
1
name: Deploy
2
2
3
3
# About this workflow:
4
-
# It is triggered on push events to branches production and testing. Then it performs a checkout of the current repo
4
+
# It is triggered on push events to the production branch. Then it performs a checkout of the current repo
5
5
# and sets up a node environment (see .nvmrc). Following, it will run `npm ci` to build the package. Next, it will look at your
6
6
# commit message, if it includes '#patch', '#minor', or '#major' it will bump the package version accordingly.
7
-
# Finally, the `npm publish` command will be run, when on branch testing it will run `npm publish --tag beta` to publish
8
-
# it under the beta flag on npm. Note: if no '#patch', '#minor', or '#major' flag is present in the latest commit
9
-
# AND the package version is not bumped manually the publish step will fail because we can not publish to an existing
10
-
# version.
7
+
# Finally, the `npm publish` command will be run. Note: if no '#patch', '#minor', or '#major' flag is present in the latest
8
+
# commit AND the package version is not bumped manually the publish step will fail because we can not publish to an
9
+
# existing version.
10
+
# Once npm has accepted the version, a GitHub release with generated notes is created.
11
+
# See .github/release.yml for how the notes are grouped.
11
12
12
13
# GitHub repo configuration:
13
14
# 1. Go to Manage access and add 'Github Actions' team with role: admin.
@@ -16,13 +17,12 @@ name: Deploy
16
17
17
18
# Note: make sure to commit package-lock.json, this is needed for `npm ci`.
18
19
19
-
# Defines the trigger for this action, in general you want it to run when pushing to production | testing. For more
20
+
# Defines the trigger for this action, in general you want it to run when pushing to production. For more
20
21
# information see: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#about-workflow-events)
21
22
on:
22
23
push:
23
24
branches:
24
25
- production
25
-
- testing
26
26
workflow_dispatch:
27
27
inputs:
28
28
versionBumpType:
@@ -33,9 +33,9 @@ jobs:
33
33
deploy_to_npm:
34
34
name: Version Bump & Deploy to NPM
35
35
36
-
# Only run this job if initiator is not the Homey Github Actions Bot to prevent loops and check if if a version bump is provided and current branch is production or testing
36
+
# Only run this job if initiator is not the Homey Github Actions Bot to prevent loops and check if a version bump is provided and current branch is production
Copy file name to clipboardExpand all lines: AGENTS.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,10 @@ Run single test file:
22
22
node --test test/onOff.js
23
23
```
24
24
25
+
## Pull Requests and Releases
26
+
27
+
Pull request titles use Conventional Commits, `type(scope): Description` with a capital letter after the prefix. The prefix decides where the change lands in the release notes: `feat` under New features, `fix` and `perf` under Fixes, a `!` before the colon under Breaking changes, and `build`, `chore`, `ci`, `docs`, `refactor`, `style` and `test` are left out. Use `feat` or `fix` for anything someone using the library would notice. How a release is cut is described under [Releasing](README.md#releasing).
28
+
25
29
## Architecture
26
30
27
31
Zigbee Cluster Library (ZCL) implementation for Node.js, designed for Homey's Zigbee stack.
Merge to production and include `#patch`, `#minor` or `#major`in the PR/commit message. Or merge to production and run the "Deploy" workflow and provide a version bump parameter.
38
+
What changed in each version is listed in the [GitHub releases](https://github.com/athombv/node-zigbee-clusters/releases). How those notes are put together is described under [Releasing](#releasing).
39
39
40
40
## About Zigbee Clusters
41
41
@@ -323,21 +323,54 @@ To regenerate TypeScript types after modifying cluster definitions:
323
323
npm run generate-types
324
324
```
325
325
326
-
This runs `scripts/generate-types.js` which loads all cluster modules and generates typed interfaces.
326
+
This runs `scripts/generate-types.mts` which loads all cluster modules and generates typed interfaces.
327
327
328
328
### Automatic Generation (GitHub Actions)
329
329
330
-
TypeScript types are automatically regenerated when changes are pushed to the `develop`branch that affect:
330
+
TypeScript types are automatically regenerated when a push to any branch other than `production` changes:
331
331
332
332
-`lib/clusters/**/*.js` - cluster definitions
333
-
-`scripts/generate-types.js` - the generator script
333
+
-`lib/Cluster.js`, `lib/constants.js` and `index.js`
334
+
-`scripts/generate-types.mts` and `scripts/template.d.ts.txt` - the generator and its template
334
335
335
-
The workflow commits updated types back to `develop` if changes are detected.
336
+
The workflow commits updated types back to that branch if changes are detected.
336
337
337
338
## Contributing
338
339
339
340
Great if you'd like to contribute to this project, a few things to take note of before submitting a PR:
340
341
341
-
- This project enforces ESLint, validate by running `npm run lint`.
342
-
- This project implements a basic test framework based on node:test, see [test](https://github.com/athombv/node-zigbee-clusters/blob/production/test) directory.
343
-
- This project uses several [GitHub Action workflows](https://github.com/athombv/node-zigbee-clusters/blob/production/.github/workflows) (e.g. ESLint, running test and versioning/publishing).
342
+
- This project enforces ESLint and Prettier: check with `npm run lint` and `npm run format:check`, and fix formatting with `npm run format:write`.
343
+
- Tests use the built-in node:test runner, see the [test](https://github.com/athombv/node-zigbee-clusters/blob/production/test) directory.
344
+
- Pull request titles follow [Conventional Commits](https://www.conventionalcommits.org/), for example `fix(onOff): Handle a missing attribute`. The title becomes a line in the release notes, so write it for someone using the library. See [Release notes](#release-notes).
345
+
-[GitHub Action workflows](https://github.com/athombv/node-zigbee-clusters/blob/production/.github/workflows) run ESLint, Prettier and the tests, and publish releases.
346
+
347
+
## Releasing
348
+
349
+
Releases are published from the `production` branch by the Deploy workflow (`.github/workflows/deploy.yml`).
350
+
351
+
1. Open a pull request from `master` into `production` with `#patch`, `#minor` or `#major` in its title, for example `Merge master into production (#minor)`.
352
+
2. Merge it with a merge commit or a squash merge, not a rebase merge. The workflow reads the marker from the commit message that lands on `production`, and only those two carry the pull request title into it.
353
+
354
+
The workflow then lints, checks formatting and runs the tests, builds, bumps the version and pushes the version commit and tag, publishes to npm with [trusted publishing](https://docs.npmjs.com/trusted-publishers), and creates a GitHub release.
355
+
356
+
Instead of using a marker, you can also start the Deploy workflow by hand on `production` and pass the version bump as input.
357
+
358
+
If creating the GitHub release fails after the npm publish, create it by hand. Running the workflow again would bump the version a second time.
359
+
360
+
### Release notes
361
+
362
+
GitHub generates the notes from the titles of the pull requests merged since the previous release, grouped by label. A workflow sets that label from the title's prefix, so a pull request lands in the right section on its own:
|`!` before the colon, as in `feat!:`| Breaking changes |
369
+
|`build`, `chore`, `ci`, `docs`, `refactor`, `style`, `test`| Left out |
370
+
| No prefix | Other changes |
371
+
372
+
The prefix itself is stripped from each line, and release pull requests into `production` are left out.
373
+
374
+
To move a pull request to another section, change its title, also after it was merged: the label follows. To reword a line, edit the release on GitHub after it is published.
375
+
376
+
The grouping is configured in `.github/release.yml`, the labeling in `.github/workflows/label-pr.yml`.
0 commit comments