Section: Release and deployment workflows

Publish an npm package

yaml
yaml
- uses: actions/setup-node@v4
  with:
    node-version: 20
    registry-url: https://registry.npmjs.org

- run: npm ci
- run: npm publish
  env:
    NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Explanation

Keep package publishing in a protected branch or tag workflow with tightly scoped permissions.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Release and deployment workflows
Create a GitHub release on tag push
Publish a release whenever a version tag is pushed.
OpenIn sheetyamlsame section
Deploy only from main after tests
Gate deployments on successful CI from the main branch.
OpenIn sheetyamlsame section
Node.js CI workflow
Install dependencies, lint, test, and build a Node project.
Python CI workflow
Set up Python, install dependencies, and run tests.
Build a Docker image
Use Buildx for modern Docker builds.