ci: add release automation and CodeQL - #2
Merged
Conversation
Ports the release workflow set from iobroker-sync, adapted for a native addon. - release-please.yml keeps an open release PR on master, deriving the version and changelog from conventional commits. Merging it tags and publishes a GitHub Release. - release.yml publishes to npm on that Release event via trusted publishing (OIDC), so no npm token is stored. Dispatchable by hand, defaulting to a dry run. - pr-title.yml validates PR titles, since release-please reads them to work out the next version. Scope vocabulary retuned for this repo, and 'master' is allowed because release-please titles its own PR chore(master). - codeql.yml analyses c-cpp and javascript. The c-cpp run compiles the addon so CodeQL can observe it, which is where the value is: src/ hand-manages stack indices, buffers and object lifetimes. The tarball guard in release.yml is the important part. This package builds from source on the user's machine, so a tarball missing the vendored Lua sources is unbuildable for everyone who installs it, and npm versions are immutable. It asserts all 29 Lua translation units are present and that build output and node_modules are not. It reads npm pack --json, whose shape changed: npm 11 and earlier emit an array, npm 12 an object keyed by package name. Handled both, verified against real output plus a synthesised array payload and a negative case, rather than assuming the shape the pinned npm happens to produce today. Bootstraps the manifest at 2.0.0 and writes CHANGELOG.md by hand for that version; release-please takes over from 2.0.1. Aligns ci.yml on the same action versions and adds prepublishOnly so a manual publish cannot skip the tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the release workflow set from
iobroker-sync, adapted for a native addon.What this adds
release-please.ymlchore(master): release x.y.zPR that accumulates merged changes, derives the version from conventional commits and rewritesCHANGELOG.mdrelease.ymlpr-title.ymlcodeql.ymlc-cppandjavascriptrelease-please-config.json/.release-please-manifest.jsonCHANGELOG.mdNothing publishes on an ordinary merge to
master. Merging the release PR is the single deliberate act that ships a version.Adaptations from iobroker-sync
master, notmain— release-please triggers onmaster, andmasteris in the allowed scope list because release-please titles its own PRchore(master): release …. Without that the release PR fails its own title check and becomes unmergeable.npm cialso compiles the addon, since the install script runs node-gyp. Ubuntu is unaffected by the Visual Studio detection problem that forcesci.ymlto pin its own node-gyp on Windows.src/is C++ driving a raw C API with hand-managed stack indices, string buffers and object lifetimes. Thec-cpprun usesbuild-mode: manualand compiles the addon so CodeQL can observe it. Path filters are not honoured for compiled languages, so alerts will appear invendor/— dismiss those as won't-fix, since Lua 5.1.5 and LuaFileSystem are vendored verbatim and not patched here.lua,napi,build,vendor,lfs,deps,docs,release,master.The tarball guard
The most important step in
release.yml. This package builds from source on the user's machine, so a tarball missing the vendored Lua sources is unbuildable for everyone who installs it — and npm versions are immutable, so the only fix is a new version. The guard asserts all 29 Lua translation units are present, that the binding sources and licences are there, and thatbuild/andnode_modules/are not.It reads
npm pack --json, whose output shape changed between npm versions: npm 11 and earlier emit an array, npm 12 an object keyed by package name. I found this by running the script rather than trusting it — the naiverequire('./pack.json')[0].filesthrows on npm 12. It now accepts either shape and fails loudly if it can read neither, so an npm upgrade cannot turn the guard into a crash or, worse, a silent pass.Verified locally against real
npm packoutput, a synthesised array-shaped payload, and a negative case with the vendored sources stripped (correctly rejected).Also
ci.ymlaligned onactions/checkout@v7/actions/setup-node@v7to match. All pinned action versions were verified to exist.prepublishOnly: npm testso a manual publish cannot skip the tests.Before the first release can run
Three things only you can do, in order:
npm owner add mschmicking node-lua-runnerwhile logged in as 0x7878 — the package is currently owned by that account.npm owner rm 0x7878 node-lua-runnerfrom mschmicking, once the add is confirmed.node-lua-runner: repositorymschmicking/node-lua-runner, workflowrelease.yml. Without this the OIDC publish is rejected — there is no token fallback by design.🤖 Generated with Claude Code