dabutvin / npm

GitHub Action for interacting with npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHub Action for NPM

This Action for npm enables arbitrary actions with the npm command-line client, including testing packages and publishing to a registry.

Usage

An example workflow to build, test, and publish an npm package to the default public registry follows:

workflow "Build, Test, and Publish" {
  on = "push"
  resolves = ["Publish"]
}

action "Build" {
  uses = "actions/npm@master"
  args = "install"
}

action "Test" {
  needs = "Build"
  uses = "actions/npm@master"
  args = "test"
}

# Filter for a new tag
action "Tag" {
  needs = "Test"
  uses = "actions/bin/filter@master"
  args = "tag"
}

action "Publish" {
  needs = "Tag"
  uses = "actions/npm@master"
  args = "publish --access public"
  secrets = ["NPM_AUTH_TOKEN"]
}

Secrets

  • NPM_AUTH_TOKEN - Optional. The token to use for authentication with the npm registry. Required for npm publish (more info)

Environment variables

  • NPM_REGISTRY_URL - Optional. To specify a registry to authenticate with. Defaults to registry.npmjs.org
  • NPM_CONFIG_USERCONFIG - Optional. To specify a non-default per-user configuration file. Defaults to $HOME/.npmrc (more info)

Example

To authenticate with, and publish to, a registry other than registry.npmjs.org:

action "Publish" {
  uses = "actions/npm@master"
  args = "publish --access public"
  env = {
    NPM_REGISTRY_URL = "someOtherRegistry.someDomain.net"
  }
  secrets = ["NPM_AUTH_TOKEN"]
}

License

The Dockerfile and associated scripts and documentation in this project are released under the MIT License.

Container images built with this project include third party materials. See THIRD_PARTY_NOTICE.md for details.

About

GitHub Action for interacting with npm

License:MIT License


Languages

Language:Shell 57.0%Language:HCL 27.9%Language:Dockerfile 14.2%Language:Ruby 0.8%