Skip to content

Instantly share code, notes, and snippets.

@tracker1
Last active October 15, 2020 00:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tracker1/fdd5ceab8f532afc3a05ab9c0bddebc1 to your computer and use it in GitHub Desktop.
Save tracker1/fdd5ceab8f532afc3a05ab9c0bddebc1 to your computer and use it in GitHub Desktop.
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