Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
NPM Publish Github Action
# scripts in package.json include the following...
# "prepare": "npm run build",
# "publish-major": "npm version major && git push origin master && git push --tags",
# "publish-minor": "npm version minor && git push origin master && git push --tags",
# "publish-patch": "npm version patch && git push origin master && git push --tags"
name: Publish to NPM
on:
push:
tags:
- v*
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
# specify node version and the registry for the RELEASE build
node-version: 12
registry-url: https://registry.npmjs.org/
- name: npm ci, publish
run: |
npm ci
NODE_ENV=production npm publish --access public
env:
# Add to github settings/secrets
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment