Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Publish to npm and GitHub Release

on:
workflow_dispatch:
inputs:
release_type:
description: 'Release type (patch, minor, major)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm install

- name: Build project
run: npm run build

- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'

- name: Bump version
run: npm version ${{ github.event.inputs.release_type }} -m "chore: release v%s"

- name: Push changes and tags
run: git push --follow-tags

- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get Version
id: get_version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
tag_name: v${{ steps.get_version.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2 changes: 1 addition & 1 deletion bin/kdm.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node

require('../dist/index.js');
import '../dist/index.js';
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@utkarsh232005/kdm-cli",
"version": "1.1.0",
"description": "Kubernetes and Docker Monitoring CLI",
"type": "module",
"main": "dist/index.js",
"repository": {
"type": "git",
Expand All @@ -21,8 +22,8 @@
"LICENSE"
],
"scripts": {
"build": "tsup src/index.ts --format cjs --dts",
"dev": "tsup src/index.ts --format cjs --watch",
"build": "tsup src/index.ts --format esm --dts",
"dev": "tsup src/index.ts --format esm --watch",
"test": "vitest run",
"prepublishOnly": "npm run build"
},
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"compilerOptions": {
"target": "es2022",
"module": "commonjs",
"module": "ESNext",
"moduleResolution": "bundler",
"lib": ["es2022", "dom"],
"declaration": true,
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"jsx": "react"
},
"include": ["src/**/*"],
Expand Down