Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,44 @@

on:
release:
# 'published' — not 'created', which also fires when a *draft* release is saved and
# would push unreleased code to npm.
types: [published]

jobs:
publish:
# The same gate as CI, re-run here on purpose. A release is cut from a tag, and nothing
# guarantees that tag points at a commit CI ever saw — so verify before publishing rather
# than assume. npm publish is irreversible: a version cannot be replaced once taken.
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
# This package declares engines >=20, so 20.x is its own baseline. The
# template pins 22.x for repos that raised their floor above 20.
node-version: 20.x
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm run lint
- run: npm run format:check
- run: npm test
- run: npm publish

publish-npm:
# Without this the publish runs regardless of the checks above.
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
- run: npm ci
# A GitHub release flagged "pre-release" goes to the `beta` dist-tag, so users
# on Manage Palette — which tracks `latest` — are not auto-upgraded onto an
# unproven build. A plain `npm publish` would move `latest` to the beta and
# push it to every install; `latest` cannot be walked back to an earlier
# version by publishing, only by a separate dist-tag change.
- run: npm publish ${{ github.event.release.prerelease && '--tag beta' || '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
14 changes: 11 additions & 3 deletions .github/workflows/standards-check.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Optional: drop into a target repo as .github/workflows/standards-check.yml
# Synced into target repos by `nrstd sync` as .github/workflows/standards-check.yml.
# Fails CI if the repo drifts from the shared standard. Tool-neutral (no AI).
# `nrstd audit` exits non-zero below 10/10, so a repo adopting this should run
# `nrstd sync --write` first — otherwise its next push goes red on pre-existing drift.
name: Standards check
on:
push:
branches: [master, main]
pull_request:
permissions:
contents: read
jobs:
standards:
runs-on: ubuntu-latest
Expand All @@ -13,6 +17,10 @@ jobs:
- uses: actions/setup-node@v7
with:
node-version: 20.x
# node-red-standards is not published to npm — install it from the repo, the same way
# it is invoked locally. `npx --yes node-red-standards` fails with E404.
# Resolved from Git, not the npm registry: this package is deliberately
# unpublished (README "Install", option B), so a bare
# `npx --yes node-red-standards` fails every run with E404 before it can
# audit anything — which reads as drift when it is really a missing
# package. The repo is public, so no token is needed. If it is ever
# published, the short form becomes available and this can go back.
- run: npx --yes github:windkh/node-red-standards audit