Publish to NPM when missing
ActionsTags
(2)GitHub action to automatically publish package to NPM if they are not already published.
Create a new .github/workflows/publish-to-npm.yml
file:
name: publish-to-npm
on:
push:
branches:
- master # Change this to your default branch
jobs:
publish-to-npm:
name: publish-to-npm
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Set up Node.js
uses: actions/setup-node@master
with:
node-version: 12.0.0
- name: Publish version
uses: geoblink/publish-to-npm@v1.0.2
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You must set this in your repo settings
NPM_AUTH_TOKEN
: this is the token the action will use to authenticate to NPM. You most generate one with publishing permissions in NPM, then you can add it to your secrets (Settings » Secrets) so that it can be passed to the action. DO NOT put the token directly in your workflow file.
Publish to NPM when missing is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.