Skip to content

Commit e98e1d0

Browse files
committed
chore: update README and GitHub Actions for publishing workflow
- Enhanced README with recommended publishing methods and detailed instructions. - Introduced a new publish-helper script for easier version bumping and publishing. - Updated GitHub Actions workflow to detect changes in package.json and publish accordingly. - Improved documentation for manual and automated publishing processes.
1 parent dc2504a commit e98e1d0

3 files changed

Lines changed: 365 additions & 28 deletions

File tree

.github/workflows/publish.yml

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,45 @@
1-
name: Publish Packages
1+
name: Publish Packages to NPM
22

33
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'packages/*/package.json'
49
workflow_dispatch:
510
inputs:
611
package:
7-
description: 'Package to publish (research, basic, cli, all)'
12+
description: 'Package to publish (basic, research, all)'
813
required: true
914
default: 'all'
15+
type: choice
16+
options:
17+
- all
18+
- basic
19+
- research
1020

1121
jobs:
1222
publish:
1323
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
id-token: write
1427

1528
steps:
16-
- uses: actions/checkout@v4
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 2
1733

18-
- uses: pnpm/action-setup@v2
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v2
1936
with:
2037
version: 8
2138

22-
- uses: actions/setup-node@v4
39+
- name: Setup Node.js
40+
uses: actions/setup-node@v4
2341
with:
24-
node-version: '18'
42+
node-version: '20'
2543
cache: 'pnpm'
2644
registry-url: 'https://registry.npmjs.org'
2745

@@ -31,13 +49,45 @@ jobs:
3149
- name: Build packages
3250
run: pnpm build
3351

34-
- name: Publish
52+
- name: Detect changed packages
53+
if: github.event_name == 'push'
54+
id: detect
3555
run: |
36-
if [ "${{ github.event.inputs.package }}" == "all" ]; then
37-
pnpm -r --filter './packages/**' publish --access public
38-
else
39-
pnpm --filter @vibes/${{ github.event.inputs.package }} publish --access public
56+
echo "Detecting package changes..."
57+
CHANGED_PACKAGES=""
58+
59+
if git diff HEAD~1 HEAD --name-only | grep -q "packages/basic/package.json"; then
60+
CHANGED_PACKAGES="${CHANGED_PACKAGES}basic,"
61+
echo "✅ basic changed"
62+
fi
63+
64+
if git diff HEAD~1 HEAD --name-only | grep -q "packages/research/package.json"; then
65+
CHANGED_PACKAGES="${CHANGED_PACKAGES}research,"
66+
echo "✅ research changed"
4067
fi
68+
69+
echo "packages=${CHANGED_PACKAGES}" >> $GITHUB_OUTPUT
70+
echo "Changed packages: ${CHANGED_PACKAGES}"
71+
72+
- name: Publish basic
73+
if: |
74+
(github.event_name == 'workflow_dispatch' && (github.event.inputs.package == 'basic' || github.event.inputs.package == 'all')) ||
75+
(github.event_name == 'push' && contains(steps.detect.outputs.packages, 'basic'))
76+
run: |
77+
cd packages/basic
78+
echo "📦 Publishing @vibe-devtools/basic..."
79+
npm publish --provenance --access public
80+
env:
81+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
82+
83+
- name: Publish research
84+
if: |
85+
(github.event_name == 'workflow_dispatch' && (github.event.inputs.package == 'research' || github.event.inputs.package == 'all')) ||
86+
(github.event_name == 'push' && contains(steps.detect.outputs.packages, 'research'))
87+
run: |
88+
cd packages/research
89+
echo "📦 Publishing @vibe-devtools/research..."
90+
npm publish --provenance --access public
4191
env:
4292
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4393

README.md

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,36 +111,63 @@ npm test
111111

112112
## 🚀 Publishing
113113

114-
### CLI (vibe-devtools)
114+
### 📋 Método Recomendado (Automático)
115+
116+
**Para atualizar READMEs ou fazer patches:**
115117

116118
```bash
117-
# Manual
118-
cd apps/cli
119+
# Usar helper script (recomendado)
120+
./scripts/publish-helper.sh
121+
122+
# Ou manualmente:
123+
cd packages/basic
124+
npm version patch # 1.0.0 → 1.0.1
125+
cd ../research
119126
npm version patch
120-
npm publish
127+
cd ../..
128+
129+
git add .
130+
git commit -m "chore: bump packages to 1.0.1"
131+
git push origin main
121132

122-
# Automated (via tag)
123-
git tag v0.3.0
124-
git push origin v0.3.0
125-
# GitHub Actions publishes automatically
133+
# GitHub Actions publica automaticamente! 🚀
126134
```
127135

128-
### Packages (@vibe-devtools/*)
136+
**O workflow detecta mudanças em `package.json` e publica automaticamente.**
137+
138+
### 📦 Via Tags (Releases Importantes)
129139

130140
```bash
131-
# Manual
141+
# Para releases com tag git:
132142
cd packages/basic
133-
npm publish
143+
npm version minor # 1.0.0 → 1.1.0
144+
cd ../..
134145

135-
# Automated (via tag)
136-
git tag packages/basic/v1.0.1
137-
git push origin packages/basic/v1.0.1
138-
# GitHub Actions publishes automatically
146+
git add .
147+
git commit -m "feat: add new features to basic"
148+
git tag packages/basic/v1.1.0
149+
git push origin main
150+
git push origin packages/basic/v1.1.0
139151

140-
# Or via workflow dispatch
141-
# Go to Actions → Publish packages → Run workflow → Select package
152+
# GitHub Actions publica via tag! 🚀
142153
```
143154

155+
### 🎯 Via Workflow Dispatch (Manual)
156+
157+
1. Ir para [GitHub Actions](https://github.com/onosendae/vibe-devtools/actions)
158+
2. Selecionar "Publish Packages to NPM"
159+
3. Click "Run workflow"
160+
4. Escolher package: `basic`, `research`, ou `all`
161+
5. Click "Run workflow"
162+
163+
### 📖 Documentação Completa
164+
165+
Ver [Workflows Guide](.github/workflows/WORKFLOWS-GUIDE.md) para detalhes completos sobre:
166+
- Como cada workflow funciona
167+
- Quando usar cada método
168+
- Troubleshooting
169+
- Best practices
170+
144171
---
145172

146173
## 🤝 Contributing

0 commit comments

Comments
 (0)