Skip to content

FrontEndDev-org/publish-node-package-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

publish-node-package-action

release marketplace license

发布 NodeJS 软件包

特性

  • 发布到 NPM 仓库,比 npm publish 更好用
  • 支持任意工程类型,如 MonoRepo、PolyRepo、SingleRepo
  • 支持任务包管理工具,如 npm、pnpm、yarn
  • 支持同步新版本到 npmMirror.com
  • 支持自动从根目录复制 License 到当前 package,如果当前软件包没有时
  • 支持自动从根目录复制 README.md 到当前 package,如果当前软件包没有时
  • 自动修剪 package.json 文件
    • 删除多余属性,如 devDependenciesscripts
    • 继承相关属性,如 authorlicense

发版到 NPM 仓库

jobs:
  publish-npm:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v4
        with:
          node-version-file: .nvmrc
          cache: npm
          cache-dependency-path: package-lock.json
      - run: npm ci
      - run: npm run build
      - run: npm run test
      - uses: FrontEndDev-org/publish-node-package-action@v5
        with:
          token: ${{ secrets.NPM_TOKEN }}

入参

名称 必填 默认值 描述
token 软件包源的授权令牌
registry https://registry.npmjs.org 软件包源地址
tag latest 版本标签,默认为 latest
dryRun false 模拟发布
includePrivate false 同时发布私有包
disableProvenance false 禁用 npm 发布的来源证明
disableSync false 禁用同步到 npmMirror.com
disableStrip false 禁用修剪软件包中 package.json 中的字段,workspace 模式时会继承相关字段
disableCopyLicense false 禁用复制根目录许可证文件(只在 workspace 模式启用,且软件包没有时)
disableCopyReadme false 禁用复制根目录 README 文件(只在 workspace 模式启用,且软件包没有时)
syncTimeout 30 同步到 npmMirror.com 超时时间(秒),默认为 30 秒

出参

About

发布 NodeJS 软件包 GitHub Action

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •