Skip to content

Publish package to NPM #32

Publish package to NPM

Publish package to NPM #32

Workflow file for this run

name: Publish package to NPM
on:
workflow_dispatch:
inputs:
version:
description: 'Enter the new version for the package'
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 14
- name: Install dependencies
run: npm install
- name: Configure Git
run: |
git config --global user.email "dprakash2101@gmail.com"
git config --global user.name "dprakash2101"
git pull
- name: Update version in package.json
run: npm version ${{ github.event.inputs.version }} --allow-same-version
- name: Commit changes
run: |
git config --global user.email "dprakash2101@gmail.com"
git config --global user.name "dprakash2101"
git add .
git commit -m "Bump version to ${{ github.event.inputs.version }}"
git push
- name: Push changes
run: git push origin main
- name: Build SDK
run: npm run build
- name: Authenticate with npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.AUTOMATE_NJS_TOKEN }}" > ~/.npmrc
- name: Publish to npm (dry run)
run: npm publish --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.AUTOMATE_NJS_TOKEN }}