Skip to content

GitHub action to publish a NodeJS package to NPM and GitHub Packages.

License

Notifications You must be signed in to change notification settings

colinparsonscom/publish-node-package

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

GitHub action to publish a NodeJS package to NPM and GitHub Packages.

Usage

See action.yml. Make sure you've stored a NPM classic token (an "Automation" token) as a secret in your repository. You can generate one at https://www.npmjs.com/settings/your-username/tokens.

Example Workflow

name: Publish my node package

on:
  release:
    types: [published]

jobs:
  publish:
    runs-on: ubuntu-latest

    permissions:
      contents: read
      packages: write

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Publish
        uses: colinparsonsme/publish-node-package@v1
        with:
          # you can store your NPM token with any name in your repository secrets
          # assuming it's stored as NPM_TOKEN here
          npm-token: ${{ secrets.NPM_TOKEN }} # optional
          # your github token is always accessed by ${{ secrets.GITHUB_TOKEN}}
          # since it's autogenerated by GitHub on each job
          github-token: ${{ secrets.GITHUB_TOKEN }} # optional; must be used with scope
          scope: '@my-username-or-organization' # optional; must be used with github-token

License

See the License.

Contributing

See the Contributing Guidelines.

Contributor Code of Conduct

See the Code of Conduct.

Contact

If you're interested in getting in touch outside of this project, check out colinparsons.com.

About

GitHub action to publish a NodeJS package to NPM and GitHub Packages.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages