Last active
October 15, 2020 00:36
-
-
Save tracker1/fdd5ceab8f532afc3a05ab9c0bddebc1 to your computer and use it in GitHub Desktop.
NPM Publish Github Action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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