File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish to npm
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ bump :
7+ description : ' Version bump type'
8+ required : false
9+ default : ' patch'
10+
11+ jobs :
12+ publish :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v4
16+
17+ - uses : actions/setup-node@v4
18+ with :
19+ node-version : ' 20'
20+ registry-url : ' https://registry.npmjs.org'
21+
22+ - run : npm install
23+
24+ - run : npm publish --access public
25+ env :
26+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env bun
2+ import { $ } from "bun" ;
3+
4+ const dir = new URL ( ".." , import . meta. url ) . pathname ;
5+ process . chdir ( dir ) ;
6+
7+ const bumpType = process . argv [ 2 ] || "patch" ;
8+
9+ console . log ( `Bumping ${ bumpType } version...` ) ;
10+
11+ // Bump version in package.json
12+ await $ `npm version ${ bumpType } --no-git-tag-version` ;
13+
14+ // Read the new version
15+ const pkg = await Bun . file ( "./package.json" ) . json ( ) ;
16+ const version = pkg . version ;
17+
18+ console . log ( `New version: ${ version } ` ) ;
19+
20+ // Commit the version bump
21+ await $ `git add package.json` ;
22+ await $ `git commit -m "Bump version to ${ version } "` ;
23+ await $ `git push` ;
24+
25+ // Trigger GitHub workflow
26+ console . log ( `Triggering publish workflow...` ) ;
27+ await $ `gh workflow run publish.yml -f bump="${ bumpType } "` ;
28+
29+ console . log ( `✓ Version bumped to ${ version } and publish workflow triggered` ) ;
You can’t perform that action at this time.
0 commit comments