Skip to content

Latest commit

 

History

History
70 lines (41 loc) · 3.08 KB

File metadata and controls

70 lines (41 loc) · 3.08 KB

publish-npm-package

Publishes a NodeJS package to an npm registry.

🃏Example

steps:
  - uses: actions/checkout@v4

  - uses: giancosta86/aurora-github/actions/publish-npm-package@v8
    with:
      npm-token: ${{ secrets.NPM_TOKEN }}

Remarks

  • This action is designed for publication only - not for verification: you should call verify-npm-package for that instead.

  • Before the first publication, running with dry-run set to true during the verification phase is recommended.

  • This action is automatically run by publish-rust-wasm.

💡How it works

  1. Run enforce-branch-version, forwarding the enforce-branch-version input to its mode input.

  2. Invoke setup-nodejs-context to set up a NodeJS environment having pnpm and dependencies.

  3. Run pnpm build if such script has been declared in package.json.

  4. Run publish-github-pages with the optional flag enabled.

  5. If the .npmrc file does not exist, generate a new one - publishing to the official npm registry and using the NPM_TOKEN environment variable as the authentication token. The .npmrc file will be displayed only if auto-generated.

  6. Run pnpm publish, with the value of npm-token injected into the NPM_TOKEN environment variable - accessible, for example, from the .npmrc configuration file.

☑️Requirements

  • The requirements for setup-nodejs-context.

  • npm-token is mandatory - unless dry-run is enabled

  • The requirements for publish-github-pages if website-directory references an existing directory.

  • Before the first publication, running with dry-run set to true is recommended.

📥Inputs

Name Type Description Default value
dry-run boolean Run a simulated publication via --dry-run false
npm-token string The secret token for publishing to the registry
website-directory string Relative directory containing the project website website
enforce-branch-version inject,check,skip How the branch version should be enforced inject
project-directory string The directory containing package.json .

🌐Further references