Skip to content

Publish to NPM and Release on Github #1

Publish to NPM and Release on Github

Publish to NPM and Release on Github #1

name: Publish to NPM and Release on Github
on:
workflow_dispatch:
inputs:
release-type:
description: 'Release type (patch, minor, major)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
jobs:
release:
name: Bump Version, Build, and Publish to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: yarn install --immutable
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Build package
run: yarn prepare
- name: Release-it
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx release-it ${{ inputs.release-type }} --ci --verbose