Skip to content

ci: publish releases to npm, add CodeQL and OpenSSF Scorecard - #10

Merged
fadyehabamer merged 4 commits into
mainfrom
ci/release-and-security
Sep 24, 2026
Merged

fadyehabamer merged 4 commits into
mainfrom
ci/release-and-security

Conversation

@fadyehabamer

Copy link
Copy Markdown
Owner

What does this PR do?

Adds release automation and supply-chain checks.

  • publish.yml: runs when a GitHub release is published (or manually, with a dry-run switch that defaults to on). It checks that the release tag equals v + the package.json version and fails otherwise, runs node build.js, fails if the committed build output is out of date (the same check as CI) and lists the packed files, then npm publish --provenance --access public. Permissions are contents: read and id-token: write; Node 24 ships an npm that supports trusted publishing, and the setup-node cache is off in this job.
  • codeql.yml: CodeQL for JavaScript/TypeScript (default queries, build-mode: none) on pushes and PRs to main and weekly. Code scanning default setup is not enabled on this repo, so this is the only CodeQL config.
  • scorecard.yml: OpenSSF Scorecard (ossf/scorecard-action@v2.4.4) on pushes to main, branch protection changes and weekly, with publish_results: true, a SARIF artifact and a code-scanning upload. The README gets the Scorecard badge.
  • CONTRIBUTING.md: a short Releasing section (bump, merge, create a vX.Y.Z release, the workflow publishes).

Publish and Scorecard don't run on pull requests (release/dispatch and default-branch only), so their first runs happen after merge.

One-time setup before the first automated release

The workflow authenticates with npm trusted publishing (OIDC), so no NPM_TOKEN secret is needed. On npmjs.com, open the package's Settings → Trusted Publisher → GitHub Actions and enter:

  • Organization or user: fadyehabamer
  • Repository: NYX
  • Workflow filename: publish.yml
  • Environment name: leave empty
  • Allowed actions: allow npm publish

Or from a terminal with npm 11.15+ and 2FA enabled:

npm trust github nyx-css --file publish.yml --repo fadyehabamer/NYX --allow-publish

Afterwards, Settings → Publishing access → "Require two-factor authentication and disallow tokens" is recommended; trusted publishing keeps working.

Notes: the repo has no dependencies and no package-lock.json, so the publish job skips npm ci, since npm ci fails without a lockfile. GitHub release v1.1.0 exists but npm is still on 1.0.3, and that tag predates this workflow. Publish 1.1.0 by hand, or ship the next version through a release. Use a lowercase v for tags: the old V1.0.3 style would fail the tag check.

Copilot AI lite review requested due to automatic review settings September 24, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-advanced-security

Copy link
Copy Markdown

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:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@fadyehabamer
fadyehabamer merged commit 47f26ce into main Sep 24, 2026
3 checks passed
@fadyehabamer
fadyehabamer deleted the ci/release-and-security branch September 24, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants