0.0.0-a665e32 • Published 6 years ago

npm-publish-action v0.0.0-a665e32

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

npm-publish-action

This GitHub Action publishes to npm with the following conventions:

branchversiontag
masterfrom package.jsonlatest
release-<version><version>-rc.<sha>next
all others0.0.0-<sha>canary

...where <sha> is the 7-character SHA of the head commit ref.

Status checks

Depending on the branch, a series of statuses will be created by this action in your checks: publish is the action's check, and publish {package-name} is a commit status created by the action that reports the version published and links to unpkg.com via "Details":

image

If you're on a release branch (release-<version>) and the <version> portion of the branch name doesn't match the version field in package.json, you'll get a pending status reminding you to update it:

image

Usage

  1. Add an actions/setup-node step to your workflow. If you have one already, ensure that the registry-url input is set (e.g. to https://registry.npmjs.org) so that this action can populate your .npmrc with authentication info:

    - uses: actions/setup-node@master
      with:
        version: 12
        registry-url: 'https://registry.npmjs.org'
  2. Add this action later in your workflow. I suggest that you place this action after any linting and/or testing actions to catch as many errors as possible before publishing.

    - uses: shawnbot/npm-publish-action@master
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        # NOTE: use the NODE_ prefix instead of NPM_ here!
        NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

That's it!