OIDC Trusted Publishing + Provenance + GitHub Actions CI/CD.
Write your package. One-click publish. Zero secrets needed.
English | 한국어
Part of Starter Series — Stop explaining CI/CD to your AI every time. Clone and start.
Docker Deploy · Discord Bot · Telegram Bot · Browser Extension · Electron App · npm Package · React Native · VS Code Extension · MCP Server · Cloudflare Pages
# 1. Click "Use this template" on GitHub (or clone)
git clone https://github.com/starter-series/npm-package-starter.git my-package
cd my-package
# 2. Install dependencies
npm install
# 3. Run tests
npm test
# 4. Start coding
# → Replace src/index.js with your package code
# → Update tests/index.test.js
# → Update package.json (name, description, author, keywords)├── src/
│ └── index.js # Main entry point (replace with your code)
├── tests/
│ └── index.test.js # Jest tests
├── .github/
│ ├── workflows/
│ │ ├── ci.yml # Lint, test, security audit
│ │ ├── cd.yml # npm publish with OIDC + provenance
│ │ └── setup.yml # Auto setup checklist on first use
│ └── PULL_REQUEST_TEMPLATE.md
├── docs/
│ └── NPM_PUBLISH_SETUP.md # Trusted publishing setup guide
├── scripts/
│ └── bump-version.js # Semver version bumper
├── eslint.config.js # ESLint v9 flat config
├── .gitignore
├── .npmignore # Keeps published package clean
└── package.json
- OIDC Trusted Publishing — Publish to npm with zero secrets, zero tokens
- Provenance Statements — Cryptographic proof that your package was built from your repo
- CI Pipeline — Security audit, lint, test on every push and PR
- CD Pipeline — One-click publish to npm + auto GitHub Release
- Version management —
npm run version:patch/minor/major - ESLint v9 — Flat config, Node + Jest globals
- Template setup — Auto-creates setup checklist issue on first use
- Minimal — 4 devDependencies, 0 runtime dependencies
| Step | What it does |
|---|---|
| Install | npm ci with lockfile verification |
| Security audit | npm audit for dependency vulnerabilities |
| Lint | ESLint v9 flat config |
| Test | Jest |
| Workflow | What it does |
|---|---|
CodeQL (codeql.yml) |
Static analysis for security vulnerabilities (push/PR + weekly) |
Maintenance (maintenance.yml) |
Weekly CI health check — auto-creates issue on failure |
Stale (stale.yml) |
Labels inactive issues/PRs after 30 days, auto-closes after 7 more |
| Step | What it does |
|---|---|
| CI | Runs full CI pipeline first |
| Version guard | Fails if git tag already exists for this version |
| Publish | npm publish --provenance --access public via OIDC |
| GitHub Release | Creates a tagged release with auto-generated notes |
How to publish:
- Set up trusted publishing (see below)
- Bump version:
npm run version:patch(orversion:minor/version:major) - Commit and push to
main - Go to Actions tab -> Publish to npm -> Run workflow
None. This template uses OIDC trusted publishing. No NPM_TOKEN needed.
npm authenticates GitHub Actions directly via OpenID Connect. See docs/NPM_PUBLISH_SETUP.md for the one-time setup.
- Go to npmjs.com -> Settings -> Trusted Publishers -> Add GitHub Actions
- Enter your repo owner, repo name, workflow:
cd.yml, environment:npm - Create a GitHub Environment named
npm(repo Settings -> Environments) - Update
package.json: setname,repository.url,description,author
That's it. No tokens, no secrets, no rotation.
npm run version:patch # 0.1.0 → 0.1.1
# commit, push
# Actions → Publish to npm → Run workflowYour package will be published with a provenance statement that anyone can verify:
npm audit signatures# Bump version
npm run version:patch # 0.1.0 → 0.1.1
npm run version:minor # 0.1.0 → 0.2.0
npm run version:major # 0.1.0 → 1.0.0
# Lint & test
npm run lint
npm testSetting up npm publishing with trusted publishers, provenance, CI/CD, and proper project structure takes time and research. This template gives you all of it in one git clone:
| This template | Manual setup | |
|---|---|---|
| OIDC trusted publishing | Pre-configured | Research + configure yourself |
| Provenance statements | Built-in | Learn the flags and permissions |
| CI pipeline | Ready to go | Write from scratch |
| Version management | One command | Manual package.json edits |
| Security audit | Every CI run | Remember to run it |
| Project structure | Best practices | Varies |
This template intentionally uses vanilla JavaScript to stay minimal. If you need TypeScript:
- Add
typescriptto devDependencies - Add a
tsconfig.json - Change
maininpackage.jsonto point to your build output - Add a
buildscript and updatefilesto include the compiled output - Rename
.jsfiles to.ts
This keeps TypeScript opt-in rather than forcing a build pipeline on everyone.
PRs welcome. Please use the PR template.