Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
package

GitHub Action

publish node package action

v1.3.1

publish node package action

package

publish node package action

Publish a NodeJS package to NPM Repository or GitHub Packages

Installation

Copy and paste the following snippet into your .yml file.

              

- name: publish node package action

uses: FrontEndDev-org/publish-node-package-action@v1.3.1

Learn more about this action in FrontEndDev-org/publish-node-package-action

Choose a version

publish-node-package-action

release marketplace license

Publish a NodeJS package to NPM or GitHub Packages

Publish to NPM Repository

PreRequirements

jobs:
  publish-npm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: npm ci
      - run: npm run build
      - uses: cloudcome/publish-node-package-action@v1
        with:
          target: npm
          token: ${{ secrets.NPM_TOKEN }}

Publish to GitHub Packages

PreRequirements

  • Requires GitHub Packages write access
  • No need to publish token

Notes

  • GitHub Packages name may change after release, in two cases:
    1. For example, the original name my-pkg will be changed to @owner/my-kg, where owner is the name of the owner name of the current repository
    2. For example, the original name @my-scope/my-pkg will be changed to @owner/my-scope__my-kg, where owner is the owner name of the current repository
  • The name attribute in package.json in the repository will not be modified
jobs:
  publish-github:
    runs-on: ubuntu-latest
    permissions:
      packages: write
    steps:
      - uses: actions/checkout@v3
      - run: npm ci
      - run: npm run build
      - uses: cloudcome/publish-node-package-action@v1
        with:
          target: github

Inputs

Name Required Default Description
target true None Packages target, optionally npm/github
token false None Target authorization token, GitHub Packages target does not need, internally has automatically obtained github.token
tag false latest The version label to release, the default is latest

Outputs

Nothing!