Skip to content

Commit a29d6cd

Browse files
author
Michael Gosha
committed
Add workflow_dispatch trigger for manual publishing
1 parent c2bb71d commit a29d6cd

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
name: Publish to npm
22

33
on:
4+
# Manual trigger from GitHub UI
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version bump type'
9+
required: true
10+
default: 'patch'
11+
type: choice
12+
options:
13+
- patch
14+
- minor
15+
- major
16+
17+
# Auto-trigger on version tags (for local publish.sh script)
418
push:
519
tags:
620
- 'v*'
@@ -10,13 +24,34 @@ jobs:
1024
runs-on: ubuntu-latest
1125
steps:
1226
- uses: actions/checkout@v4
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
1329

1430
- uses: actions/setup-node@v4
1531
with:
1632
node-version: '20'
1733
registry-url: 'https://registry.npmjs.org'
1834
cache: 'npm'
1935

36+
- name: Configure git
37+
if: github.event_name == 'workflow_dispatch'
38+
run: |
39+
git config user.name "github-actions[bot]"
40+
git config user.email "github-actions[bot]@users.noreply.github.com"
41+
42+
- name: Bump version
43+
if: github.event_name == 'workflow_dispatch'
44+
run: |
45+
cd packages/cli
46+
npm version ${{ inputs.version }} --no-git-tag-version
47+
VERSION=$(node -p "require('./package.json').version")
48+
cd ../..
49+
git add packages/cli/package.json
50+
git commit -m "Release v${VERSION}"
51+
git tag "v${VERSION}"
52+
git push
53+
git push --tags
54+
2055
- name: Install dependencies
2156
run: npm ci
2257

0 commit comments

Comments
 (0)