Skip to content

Node.js Package

Node.js Package #45

Workflow file for this run

name: Node.js Package
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 14, 16, 18 ]
name: Node ${{ matrix.node }} sample
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm test
publish-npm:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v1
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo:
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm update
- run: npm install
- run: npm audit fix
- run: npm test
- run: git config --global user.email "montumodi@gmail.com"
- run: git config --global user.name "Ashish Modi"
- run: git commit -m "Add changes" -a
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- run: npm version minor
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}