Skip to content

Make tag and publish to NPM #6

Make tag and publish to NPM

Make tag and publish to NPM #6

name: Make tag and publish to NPM
on:
workflow_dispatch:
inputs:
bump:
description: 'Bump'
required: true
jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Bump version and push tag
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
if [ ${{ github.event.inputs.bump }} = "major" ]; then
npm version major
elif [ ${{ github.event.inputs.bump }} = "minor" ]; then
npm version minor
elif [ ${{ github.event.inputs.bump }} = "patch" ]; then
npm version patch
else
echo "Invalid bump type"
exit 1
fi
git push origin --tags
git push
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN_CI }}