Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.51 KB

PUBLISHING.md

File metadata and controls

40 lines (31 loc) · 1.51 KB

Publishing to npm

Use release script to publish the package:

  • npm run release – release a new patch version to npm
  • npm run release minor – release a new minor version to npm
  • npm run release major – release a new major version to npm
  • npm run release minor -- --stage alpha – release a new minor alpha version to npm (for example, 1.1.0-alpha.0)

Note that release script will always publish public packages to npm. If you want to publish a private package, change release script in scripts/release.ts.

Publishing with GitHub Actions

  1. Create npm authentication token and add it as NPM_TOKEN to your repository secrets (Settings -> Secrets and variables -> Actions -> New repository secret).

  2. Create .github/workflows/publish.yml with the following content. Note that if your default branch is main, you should change it in the publish action.

on:
  push:
    branches: master

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v3
        with:
          node-version-file: '.nvmrc'
          cache: 'yarn'
          cache-dependency-path: '**/yarn.lock'
      - run: yarn
      - run: npm test
      - uses: JS-DevTools/npm-publish@v3
        with:
          token: ${{ secrets.NPM_TOKEN }}
  1. To create a new release, use commands from the previous section but with --no-publish flag, for example: npm run release minor -- --no-publish.