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
99 changes: 99 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Publish Packages

# This workflow publishes packages to npm when changes are merged to main branch or when manually triggered.

on:
push:
paths:
- package.json
# For security reasons, this should never be set to anything but `main`
branches: [main]
workflow_dispatch:

permissions:
contents: read
# For npm OIDC (https://docs.npmjs.com/trusted-publishers)
id-token: write

env:
COMMIT_SHA: ${{ github.sha }}

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
# Output the matrix of packages to publish for use in the publish job
should_publish: ${{ steps.check.outputs.should_publish }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit

- name: Verify commit authenticity
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get commit data from GitHub API to verify its authenticity
COMMIT_DATA=$(gh api repos/${{ github.repository }}/commits/$COMMIT_SHA)
# Check if commit signature is verified (GPG signed)
VERIFIED=$(echo "$COMMIT_DATA" | jq -r '.commit.verification.verified')
# Check if commit was made through GitHub's web interface (merge queue)
COMMITTER=$(echo "$COMMIT_DATA" | jq -r '.commit.committer.email')
# Security checks to ensure we only publish from verified and trusted sources
if [[ "$VERIFIED" != "true" ]]; then
echo "❌ Unverified commit! Aborting."
exit 1
fi
if [[ "$COMMITTER" != "noreply@github.com" ]]; then
echo "❌ Not merged with the merge queue! Aborting."
exit 1
fi
echo "✅ Commit is verified and trusted."
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 2 # Need at least 2 commits to detect changes between commits

- name: Check if we should publish
id: check
env:
EVENT_NAME: ${{ github.event_name }}
run: |
OLD_VERSION=$(git show $COMMIT_SHA~1:package.json | jq -r '.version')
NEW_VERSION=$(jq -r '.version' "package.json")
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
echo "should_publish=true" >> $GITHUB_OUTPUT
fi
publish:
needs: prepare
runs-on: ubuntu-latest
if: needs.prepare.outputs.should_publish == 'true'
steps:
- uses: nodejs/web-team/actions/setup-environment@9f3c83af227d721768d9dbb63009a47ed4f4282f
with:
pnpm: true
use-version-file: true
registry-url: 'https://registry.npmjs.org'

- name: Publish
run: npm publish --access public --no-git-checks

- name: Notify
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # 2.3.3
env:
SLACK_COLOR: '#43853D'
SLACK_ICON: https://github.com/nodejs.png?size=48
SLACK_TITLE: ':rocket: Package Published: @node-core/doc-kit'
SLACK_MESSAGE: |
:package: *Package*: `@node-core/doc-kit` (<https://www.npmjs.com/package/@node-core/doc-kit|View on npm>)
:bust_in_silhouette: *Published by*: ${{ github.triggering_actor }}
:octocat: *Commit*: <https://github.com/${{ github.repository }}/commit/${{ env.COMMIT_SHA }}|${{ env.COMMIT_SHA }}>
SLACK_USERNAME: nodejs-bot
SLACK_CHANNEL: nodejs-web-infra
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `@nodejs/doc-kit` Contributing Guide
# `@node-core/doc-kit` Contributing Guide

Thank you for your interest in contributing to the `@nodejs/doc-kit` project! We welcome contributions from everyone, and we appreciate your help in making this project better.
Thank you for your interest in contributing to the `@node-core/doc-kit` project! We welcome contributions from everyone, and we appreciate your help in making this project better.

## Table of Contents

Expand All @@ -26,7 +26,7 @@ Thank you for your interest in contributing to the `@nodejs/doc-kit` project! We

## Getting Started

The steps below will give you a general idea of how to prepare your local environment for the `@nodejs/doc-kit` project and general steps for getting things done and landing your contribution.
The steps below will give you a general idea of how to prepare your local environment for the `@node-core/doc-kit` project and general steps for getting things done and landing your contribution.

### Prerequisites

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</p>

<p align="center">
<code>@nodejs/doc-kit</code> is a tool to generate API documentation of Node.js. <a href="https://github.com/nodejs/node/issues/52343">See this issue</a> for more information.
<code>@node-core/doc-kit</code> is a tool to generate API documentation of Node.js. <a href="https://github.com/nodejs/node/issues/52343">See this issue</a> for more information.
</p>

<p align="center">
Expand Down Expand Up @@ -40,7 +40,7 @@ $ node bin/cli.mjs --help
```

```
Usage: @nodejs/doc-kit [options] [command]
Usage: @node-core/doc-kit [options] [command]
CLI tool to generate the Node.js API documentation
Expand All @@ -56,7 +56,7 @@ Commands:
### `generate`

```
Usage: @nodejs/doc-kit generate [options]
Usage: @node-core/doc-kit generate [options]
Generate API docs
Expand All @@ -75,7 +75,7 @@ Options:
### `interactive`

```
Usage: @nodejs/doc-kit interactive [options]
Usage: @node-core/doc-kit interactive [options]
Launch guided CLI wizard
Expand Down
2 changes: 1 addition & 1 deletion bin/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { LogLevel } from '../src/logger/constants.mjs';
import logger from '../src/logger/index.mjs';

const program = new Command()
.name('@nodejs/doc-kit')
.name('@node-core/doc-kit')
.description('CLI tool to generate the Node.js API documentation')
.addOption(
new Option('--log-level <level>', 'Log level')
Expand Down
2 changes: 1 addition & 1 deletion docs/comparators.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Creating Comparators

This guide explains how to create build comparison scripts for `@nodejs/doc-kit`. Comparators help identify differences between documentation builds, useful for CI/CD and regression testing.
This guide explains how to create build comparison scripts for `@node-core/doc-kit`. Comparators help identify differences between documentation builds, useful for CI/CD and regression testing.

## Comparator Concepts

Expand Down
2 changes: 1 addition & 1 deletion docs/generators.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Creating Generators

This guide explains how to create new documentation generators for `@nodejs/doc-kit`.
This guide explains how to create new documentation generators for `@node-core/doc-kit`.

## Generator Concepts

Expand Down
20 changes: 6 additions & 14 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@nodejs/doc-kit",
"name": "@node-core/doc-kit",
"type": "module",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/nodejs/api-docs-tooling.git"
"url": "git+https://github.com/nodejs/doc-kit.git"
},
"scripts": {
"lint": "eslint . --no-warn-ignored",
Expand Down
2 changes: 1 addition & 1 deletion src/generators/man-page/template.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\"
.\" This file was generated automatically by the @nodejs/doc-kit tool.
.\" This file was generated automatically by the @node-core/doc-kit tool.
.\" Please do not edit this file manually. Make any updates to cli.md
.\" and regenerate the file afterward.
.\"
Expand Down
Loading