Skip to content

Commit e2f0a62

Browse files
committed
workflow updated
1 parent faa0af3 commit e2f0a62

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.github/workflows/publish.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: Publish to npm
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: "Version to publish (patch, minor, major, or specific version)"
10+
required: true
11+
default: "patch"
612

713
jobs:
814
build-and-publish:
@@ -20,8 +26,23 @@ jobs:
2026
- name: Install dependencies
2127
run: npm ci
2228

29+
- name: Clean build directory
30+
run: npm run clean
31+
2332
- name: Build package
24-
run: npm run build
33+
run: |
34+
npm run build
35+
npm run build:types
36+
37+
- name: Update version (if using workflow_dispatch)
38+
if: github.event_name == 'workflow_dispatch'
39+
run: |
40+
if [[ "${{ github.event.inputs.version }}" =~ ^(patch|minor|major)$ ]]; then
41+
npm version ${{ github.event.inputs.version }} --no-git-tag-version
42+
else
43+
npm version ${{ github.event.inputs.version }} --allow-same-version --no-git-tag-version
44+
fi
45+
echo "New version: $(npm pkg get version)"
2546
2647
- name: Publish to npm
2748
run: npm publish --access public

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"build-storybook": "storybook build",
1919
"clean": "rimraf dist",
2020
"lint": "eslint src --ext .ts,.tsx",
21-
"prepare": "npm run clean && npm run build && npm run build:types",
22-
"prepublishOnly": "npm run lint && npm test"
21+
"prepare": "npm run clean && npm run build && npm run build:types"
2322
},
2423
"keywords": [
2524
"tanstack",

0 commit comments

Comments
 (0)