Publish package to NPM #32
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
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 }} |