httpcat-cli 0.0.27 → 0.1.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +2 -0
- package/.github/workflows/README.md +37 -4
- package/.github/workflows/ci.yml +31 -20
- package/.github/workflows/homebrew-tap.yml +1 -1
- package/.github/workflows/publish-switch.yml +41 -0
- package/.github/workflows/rc-publish.yml +196 -0
- package/.github/workflows/release.yml +267 -85
- package/README.md +107 -108
- package/bun.lock +2933 -0
- package/dist/commands/account.d.ts.map +1 -1
- package/dist/commands/account.js +14 -7
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/balances.d.ts.map +1 -0
- package/dist/commands/balances.js +171 -0
- package/dist/commands/balances.js.map +1 -0
- package/dist/commands/buy.d.ts.map +1 -1
- package/dist/commands/buy.js +743 -35
- package/dist/commands/buy.js.map +1 -1
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +467 -906
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/claim.d.ts.map +1 -0
- package/dist/commands/claim.js +65 -0
- package/dist/commands/claim.js.map +1 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +0 -1
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/info.d.ts.map +1 -1
- package/dist/commands/info.js +143 -38
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +31 -27
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/positions.d.ts.map +1 -1
- package/dist/commands/positions.js +178 -106
- package/dist/commands/positions.js.map +1 -1
- package/dist/commands/sell.d.ts.map +1 -1
- package/dist/commands/sell.js +720 -28
- package/dist/commands/sell.js.map +1 -1
- package/dist/index.js +321 -104
- package/dist/index.js.map +1 -1
- package/dist/interactive/shell.d.ts.map +1 -1
- package/dist/interactive/shell.js +328 -179
- package/dist/interactive/shell.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +8 -8
- package/dist/mcp/tools.js.map +1 -1
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +66 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +3 -5
- package/dist/utils/formatting.js.map +1 -1
- package/dist/utils/token-resolver.d.ts.map +1 -1
- package/dist/utils/token-resolver.js +70 -68
- package/dist/utils/token-resolver.js.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +4 -3
- package/dist/utils/validation.js.map +1 -1
- package/jest.config.js +1 -1
- package/package.json +19 -13
- package/tests/README.md +0 -1
- package/.claude/settings.local.json +0 -41
- package/dist/commands/balance.d.ts.map +0 -1
- package/dist/commands/balance.js +0 -112
- package/dist/commands/balance.js.map +0 -1
- package/homebrew-httpcat/Formula/httpcat.rb +0 -18
- package/homebrew-httpcat/README.md +0 -31
- package/homebrew-httpcat/homebrew-httpcat/Formula/httpcat.rb +0 -18
- package/homebrew-httpcat/homebrew-httpcat/README.md +0 -31
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
name: Release
|
|
2
2
|
|
|
3
|
+
# This is a reusable workflow called by publish-switch.yml
|
|
3
4
|
on:
|
|
4
|
-
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*.*.*' # Triggers on semantic version tags (e.g., v1.2.3)
|
|
7
|
-
workflow_dispatch:
|
|
5
|
+
workflow_call:
|
|
8
6
|
inputs:
|
|
9
7
|
version:
|
|
10
|
-
description:
|
|
11
|
-
required:
|
|
8
|
+
description: "Version to release (e.g., 1.2.3). Leave empty for auto-detection from commits."
|
|
9
|
+
required: false
|
|
12
10
|
type: string
|
|
13
11
|
|
|
14
12
|
env:
|
|
15
|
-
NODE_VERSION:
|
|
16
|
-
REGISTRY_URL:
|
|
13
|
+
NODE_VERSION: "20"
|
|
14
|
+
REGISTRY_URL: "https://registry.npmjs.org"
|
|
17
15
|
|
|
18
16
|
jobs:
|
|
19
17
|
# Job 1: Validate and prepare release
|
|
20
18
|
prepare:
|
|
21
19
|
name: Prepare Release
|
|
22
20
|
runs-on: ubuntu-latest
|
|
21
|
+
permissions:
|
|
22
|
+
contents: write # For creating tags
|
|
23
23
|
outputs:
|
|
24
24
|
version: ${{ steps.version.outputs.version }}
|
|
25
25
|
tag: ${{ steps.version.outputs.tag }}
|
|
@@ -27,54 +27,191 @@ jobs:
|
|
|
27
27
|
release-notes: ${{ steps.notes.outputs.notes }}
|
|
28
28
|
steps:
|
|
29
29
|
- name: Checkout code
|
|
30
|
-
uses: actions/checkout@
|
|
30
|
+
uses: actions/checkout@v6
|
|
31
31
|
with:
|
|
32
|
-
fetch-depth: 0
|
|
32
|
+
fetch-depth: 0 # Full history for changelog generation
|
|
33
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
33
34
|
|
|
34
35
|
- name: Setup Node.js
|
|
35
|
-
uses: actions/setup-node@
|
|
36
|
+
uses: actions/setup-node@v6
|
|
36
37
|
with:
|
|
37
38
|
node-version: ${{ env.NODE_VERSION }}
|
|
38
39
|
registry-url: ${{ env.REGISTRY_URL }}
|
|
39
40
|
|
|
40
|
-
- name:
|
|
41
|
+
- name: Determine version
|
|
41
42
|
id: version
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
43
|
+
uses: actions/github-script@v8
|
|
44
|
+
with:
|
|
45
|
+
script: |
|
|
46
|
+
const fs = require('fs');
|
|
47
|
+
const { execSync } = require('child_process');
|
|
48
|
+
|
|
49
|
+
let version;
|
|
50
|
+
|
|
51
|
+
// Check if version was passed as input (from workflow_call)
|
|
52
|
+
const workflowInputVersion = '${{ inputs.version }}';
|
|
53
|
+
if (workflowInputVersion && workflowInputVersion !== '' && workflowInputVersion !== 'null') {
|
|
54
|
+
// Version provided via workflow_call input
|
|
55
|
+
version = workflowInputVersion.replace(/^v/, '');
|
|
56
|
+
console.log(`Using provided version: ${version}`);
|
|
57
|
+
} else if (context.ref.startsWith('refs/tags/')) {
|
|
58
|
+
// Tag-based release
|
|
59
|
+
version = context.ref.replace('refs/tags/v', '');
|
|
60
|
+
} else {
|
|
61
|
+
// Push to main - auto-detect version bump from commits
|
|
62
|
+
console.log('🔍 Analyzing commits to determine version bump...');
|
|
63
|
+
|
|
64
|
+
// Get current version from package.json
|
|
65
|
+
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
66
|
+
const currentVersion = packageJson.version.replace(/-.*$/, '');
|
|
67
|
+
console.log(`Current version: ${currentVersion}`);
|
|
68
|
+
|
|
69
|
+
// Get last release tag
|
|
70
|
+
let lastTag;
|
|
71
|
+
try {
|
|
72
|
+
const { data: releases } = await github.rest.repos.listReleases({
|
|
73
|
+
owner: context.repo.owner,
|
|
74
|
+
repo: context.repo.repo,
|
|
75
|
+
per_page: 1
|
|
76
|
+
});
|
|
77
|
+
lastTag = releases.length > 0 ? releases[0].tag_name : null;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
console.log('Could not fetch releases, trying git tags...');
|
|
80
|
+
try {
|
|
81
|
+
lastTag = execSync('git describe --tags --abbrev=0', { encoding: 'utf8' }).trim();
|
|
82
|
+
} catch (e2) {
|
|
83
|
+
lastTag = null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Get commits to analyze
|
|
88
|
+
let compareData;
|
|
89
|
+
if (lastTag) {
|
|
90
|
+
console.log(`Last release tag: ${lastTag}`);
|
|
91
|
+
|
|
92
|
+
// Get commits since last tag
|
|
93
|
+
let baseSha;
|
|
94
|
+
try {
|
|
95
|
+
const { data: tagData } = await github.rest.git.getRef({
|
|
96
|
+
owner: context.repo.owner,
|
|
97
|
+
repo: context.repo.repo,
|
|
98
|
+
ref: `tags/${lastTag}`
|
|
99
|
+
});
|
|
100
|
+
baseSha = tagData.object.sha;
|
|
101
|
+
} catch (e) {
|
|
102
|
+
try {
|
|
103
|
+
const { data: commitData } = await github.rest.repos.getCommit({
|
|
104
|
+
owner: context.repo.owner,
|
|
105
|
+
repo: context.repo.repo,
|
|
106
|
+
ref: lastTag
|
|
107
|
+
});
|
|
108
|
+
baseSha = commitData.sha;
|
|
109
|
+
} catch (e2) {
|
|
110
|
+
baseSha = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const response = await github.rest.repos.compareCommits({
|
|
115
|
+
owner: context.repo.owner,
|
|
116
|
+
repo: context.repo.repo,
|
|
117
|
+
base: baseSha || 'main',
|
|
118
|
+
head: context.sha
|
|
119
|
+
});
|
|
120
|
+
compareData = response.data;
|
|
121
|
+
} else {
|
|
122
|
+
console.log('⚠️ No previous tags found, analyzing recent commits...');
|
|
123
|
+
// Get recent commits (last 50) to determine bump type
|
|
124
|
+
const response = await github.rest.repos.listCommits({
|
|
125
|
+
owner: context.repo.owner,
|
|
126
|
+
repo: context.repo.repo,
|
|
127
|
+
per_page: 50
|
|
128
|
+
});
|
|
129
|
+
compareData = { commits: response.data };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Analyze commit messages for version bump type
|
|
133
|
+
let bumpType = 'patch'; // Default to patch
|
|
134
|
+
|
|
135
|
+
for (const commit of compareData.commits) {
|
|
136
|
+
const message = commit.commit.message;
|
|
137
|
+
const firstLine = message.split('\n')[0];
|
|
138
|
+
|
|
139
|
+
if (/^BREAKING/i.test(firstLine)) {
|
|
140
|
+
bumpType = 'major';
|
|
141
|
+
break; // Major takes precedence, no need to check further
|
|
142
|
+
} else if (/^(feat|feature)[(:]/i.test(firstLine)) {
|
|
143
|
+
if (bumpType !== 'major') {
|
|
144
|
+
bumpType = 'minor';
|
|
145
|
+
}
|
|
146
|
+
} else if (/^fix[(]/i.test(firstLine)) {
|
|
147
|
+
// Keep as patch if not already minor or major
|
|
148
|
+
if (bumpType === 'patch') {
|
|
149
|
+
bumpType = 'patch';
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
console.log(`Detected bump type: ${bumpType}`);
|
|
155
|
+
|
|
156
|
+
// Calculate new version
|
|
157
|
+
const [major, minor, patch] = currentVersion.split('.').map(Number);
|
|
158
|
+
let newVersion;
|
|
159
|
+
|
|
160
|
+
if (bumpType === 'major') {
|
|
161
|
+
newVersion = `${major + 1}.0.0`;
|
|
162
|
+
} else if (bumpType === 'minor') {
|
|
163
|
+
newVersion = `${major}.${minor + 1}.0`;
|
|
164
|
+
} else {
|
|
165
|
+
newVersion = `${major}.${minor}.${patch + 1}`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
version = newVersion;
|
|
169
|
+
console.log(`✅ New version: ${version}`);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Validate semantic version format
|
|
173
|
+
if (!/^\d+\.\d+\.\d+(-[a-zA-Z0-9-]+(\.[0-9]+)?)?$/.test(version)) {
|
|
174
|
+
throw new Error(`Invalid version format: ${version}. Expected format: X.Y.Z or X.Y.Z-prerelease`);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
core.setOutput('version', version);
|
|
178
|
+
core.setOutput('tag', `v${version}`);
|
|
179
|
+
core.setOutput('npm-version', version);
|
|
180
|
+
console.log(`✅ Final version: ${version}`);
|
|
63
181
|
|
|
64
|
-
- name:
|
|
182
|
+
- name: Update package.json version
|
|
65
183
|
run: |
|
|
66
184
|
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
67
185
|
RELEASE_VERSION="${{ steps.version.outputs.version }}"
|
|
68
|
-
|
|
186
|
+
|
|
69
187
|
if [ "$CURRENT_VERSION" != "$RELEASE_VERSION" ]; then
|
|
70
|
-
echo "
|
|
71
|
-
echo "Updating package.json..."
|
|
188
|
+
echo "Updating package.json from $CURRENT_VERSION to $RELEASE_VERSION..."
|
|
72
189
|
npm version "$RELEASE_VERSION" --no-git-tag-version --allow-same-version
|
|
190
|
+
else
|
|
191
|
+
echo "✅ package.json already at version $RELEASE_VERSION"
|
|
192
|
+
fi
|
|
193
|
+
|
|
194
|
+
- name: Create and push git tag
|
|
195
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/')
|
|
196
|
+
run: |
|
|
197
|
+
TAG="${{ steps.version.outputs.tag }}"
|
|
198
|
+
VERSION="${{ steps.version.outputs.version }}"
|
|
199
|
+
|
|
200
|
+
# Check if tag already exists
|
|
201
|
+
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
|
202
|
+
echo "⚠️ Tag $TAG already exists, skipping tag creation"
|
|
203
|
+
else
|
|
204
|
+
echo "Creating tag $TAG..."
|
|
205
|
+
git config user.name "github-actions[bot]"
|
|
206
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
207
|
+
git tag -a "$TAG" -m "Release $VERSION"
|
|
208
|
+
git push origin "$TAG"
|
|
209
|
+
echo "✅ Tag $TAG created and pushed"
|
|
73
210
|
fi
|
|
74
211
|
|
|
75
212
|
- name: Generate release notes
|
|
76
213
|
id: notes
|
|
77
|
-
uses: actions/github-script@
|
|
214
|
+
uses: actions/github-script@v8
|
|
78
215
|
with:
|
|
79
216
|
script: |
|
|
80
217
|
const { data: releases } = await github.rest.repos.listReleases({
|
|
@@ -82,10 +219,10 @@ jobs:
|
|
|
82
219
|
repo: context.repo.repo,
|
|
83
220
|
per_page: 1
|
|
84
221
|
});
|
|
85
|
-
|
|
222
|
+
|
|
86
223
|
const lastTag = releases.length > 0 ? releases[0].tag_name : null;
|
|
87
224
|
const currentTag = 'v${{ steps.version.outputs.version }}';
|
|
88
|
-
|
|
225
|
+
|
|
89
226
|
// Get commits since last release
|
|
90
227
|
let baseSha;
|
|
91
228
|
if (lastTag) {
|
|
@@ -114,21 +251,21 @@ jobs:
|
|
|
114
251
|
});
|
|
115
252
|
baseSha = branchData.commit.sha;
|
|
116
253
|
}
|
|
117
|
-
|
|
254
|
+
|
|
118
255
|
const { data: commits } = await github.rest.repos.compareCommits({
|
|
119
256
|
owner: context.repo.owner,
|
|
120
257
|
repo: context.repo.repo,
|
|
121
258
|
base: baseSha,
|
|
122
259
|
head: context.sha
|
|
123
260
|
});
|
|
124
|
-
|
|
261
|
+
|
|
125
262
|
// Categorize commits
|
|
126
263
|
const features = [];
|
|
127
264
|
const fixes = [];
|
|
128
265
|
const docs = [];
|
|
129
266
|
const chore = [];
|
|
130
267
|
const breaking = [];
|
|
131
|
-
|
|
268
|
+
|
|
132
269
|
for (const commit of commits.commits) {
|
|
133
270
|
const message = commit.commit.message;
|
|
134
271
|
const firstLine = message.split('\n')[0];
|
|
@@ -145,29 +282,29 @@ jobs:
|
|
|
145
282
|
chore.push(`- ${firstLine}`);
|
|
146
283
|
}
|
|
147
284
|
}
|
|
148
|
-
|
|
285
|
+
|
|
149
286
|
let notes = `## 🎉 Release ${{ steps.version.outputs.version }}\n\n`;
|
|
150
|
-
|
|
287
|
+
|
|
151
288
|
if (breaking.length > 0) {
|
|
152
289
|
notes += `### ⚠️ Breaking Changes\n${breaking.join('\n')}\n\n`;
|
|
153
290
|
}
|
|
154
|
-
|
|
291
|
+
|
|
155
292
|
if (features.length > 0) {
|
|
156
293
|
notes += `### ✨ Features\n${features.join('\n')}\n\n`;
|
|
157
294
|
}
|
|
158
|
-
|
|
295
|
+
|
|
159
296
|
if (fixes.length > 0) {
|
|
160
297
|
notes += `### 🐛 Bug Fixes\n${fixes.join('\n')}\n\n`;
|
|
161
298
|
}
|
|
162
|
-
|
|
299
|
+
|
|
163
300
|
if (docs.length > 0) {
|
|
164
301
|
notes += `### 📚 Documentation\n${docs.join('\n')}\n\n`;
|
|
165
302
|
}
|
|
166
|
-
|
|
303
|
+
|
|
167
304
|
if (chore.length > 0 && chore.length < 10) {
|
|
168
305
|
notes += `### 🔧 Other Changes\n${chore.join('\n')}\n\n`;
|
|
169
306
|
}
|
|
170
|
-
|
|
307
|
+
|
|
171
308
|
notes += `### 📦 Installation\n\n`;
|
|
172
309
|
notes += `\`\`\`bash\n`;
|
|
173
310
|
notes += `# npm\n`;
|
|
@@ -177,7 +314,7 @@ jobs:
|
|
|
177
314
|
notes += `\`\`\`\n\n`;
|
|
178
315
|
notes += `---\n\n`;
|
|
179
316
|
notes += `**Full Changelog**: https://github.com/${{ github.repository }}/compare/${lastTag || 'main'}...${currentTag}`;
|
|
180
|
-
|
|
317
|
+
|
|
181
318
|
core.setOutput('notes', notes);
|
|
182
319
|
console.log('Generated release notes');
|
|
183
320
|
|
|
@@ -188,31 +325,36 @@ jobs:
|
|
|
188
325
|
needs: prepare
|
|
189
326
|
steps:
|
|
190
327
|
- name: Checkout code
|
|
191
|
-
uses: actions/checkout@
|
|
328
|
+
uses: actions/checkout@v6
|
|
329
|
+
|
|
330
|
+
- name: Setup Bun
|
|
331
|
+
uses: oven-sh/setup-bun@v1
|
|
332
|
+
with:
|
|
333
|
+
bun-version: latest
|
|
192
334
|
|
|
193
335
|
- name: Setup Node.js
|
|
194
|
-
uses: actions/setup-node@
|
|
336
|
+
uses: actions/setup-node@v6
|
|
195
337
|
with:
|
|
196
338
|
node-version: ${{ env.NODE_VERSION }}
|
|
197
|
-
cache: 'yarn'
|
|
198
339
|
|
|
199
340
|
- name: Install dependencies
|
|
200
|
-
run:
|
|
341
|
+
run: bun install --frozen-lockfile
|
|
201
342
|
|
|
202
343
|
- name: Run linter (if configured)
|
|
203
344
|
continue-on-error: true
|
|
204
345
|
run: |
|
|
205
346
|
if [ -f ".eslintrc" ] || [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ]; then
|
|
206
|
-
|
|
347
|
+
bun run lint
|
|
207
348
|
else
|
|
208
349
|
echo "No linter configured, skipping..."
|
|
209
350
|
fi
|
|
210
351
|
|
|
211
352
|
- name: Run tests
|
|
212
|
-
run:
|
|
353
|
+
run: bun run test
|
|
354
|
+
# Note: Using Vitest now instead of Jest
|
|
213
355
|
|
|
214
356
|
- name: Build
|
|
215
|
-
run:
|
|
357
|
+
run: bun run build
|
|
216
358
|
|
|
217
359
|
- name: Verify build output
|
|
218
360
|
run: |
|
|
@@ -232,42 +374,79 @@ jobs:
|
|
|
232
374
|
url: https://www.npmjs.com/package/httpcat-cli
|
|
233
375
|
permissions:
|
|
234
376
|
contents: read
|
|
235
|
-
id-token: write
|
|
377
|
+
id-token: write # Required for OIDC trusted publishing (no token needed!)
|
|
236
378
|
steps:
|
|
237
379
|
- name: Checkout code
|
|
238
|
-
uses: actions/checkout@
|
|
380
|
+
uses: actions/checkout@v6
|
|
239
381
|
|
|
240
382
|
- name: Setup Node.js
|
|
241
|
-
uses: actions/setup-node@
|
|
383
|
+
uses: actions/setup-node@v6
|
|
242
384
|
with:
|
|
243
385
|
node-version: ${{ env.NODE_VERSION }}
|
|
244
386
|
registry-url: ${{ env.REGISTRY_URL }}
|
|
245
387
|
|
|
388
|
+
- name: Update npm to latest
|
|
389
|
+
run: npm install -g npm@latest
|
|
390
|
+
# npm 11.5.1+ required for trusted publishing (OIDC)
|
|
391
|
+
|
|
246
392
|
- name: Update package.json version
|
|
247
393
|
run: |
|
|
248
394
|
npm version "${{ needs.prepare.outputs.version }}" --no-git-tag-version --allow-same-version
|
|
249
395
|
|
|
396
|
+
- name: Setup Bun
|
|
397
|
+
uses: oven-sh/setup-bun@v1
|
|
398
|
+
with:
|
|
399
|
+
bun-version: latest
|
|
400
|
+
|
|
250
401
|
- name: Install dependencies
|
|
251
|
-
run:
|
|
402
|
+
run: bun install --frozen-lockfile
|
|
252
403
|
|
|
253
404
|
- name: Build
|
|
254
|
-
run:
|
|
405
|
+
run: bun run build
|
|
255
406
|
|
|
256
407
|
- name: Publish to npm
|
|
257
|
-
run: npm publish --
|
|
258
|
-
|
|
259
|
-
|
|
408
|
+
run: npm publish --access public
|
|
409
|
+
# Uses trusted publishing (OIDC) - no token needed!
|
|
410
|
+
# Configure trusted publisher at: https://www.npmjs.com/package/httpcat-cli/settings
|
|
411
|
+
# Provenance is automatically generated when using trusted publishing
|
|
260
412
|
|
|
261
413
|
- name: Verify npm publication
|
|
262
414
|
run: |
|
|
263
|
-
sleep 5 # Wait for npm CDN propagation
|
|
264
415
|
VERSION="${{ needs.prepare.outputs.version }}"
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
416
|
+
MAX_ATTEMPTS=10
|
|
417
|
+
INITIAL_WAIT=5
|
|
418
|
+
ATTEMPT=1
|
|
419
|
+
|
|
420
|
+
echo "Waiting for npm CDN propagation for httpcat-cli@$VERSION..."
|
|
421
|
+
|
|
422
|
+
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
|
|
423
|
+
# Exponential backoff: 5s, 10s, 20s, 40s, etc. (capped at 60s)
|
|
424
|
+
WAIT_TIME=$((INITIAL_WAIT * (2 ** (ATTEMPT - 1))))
|
|
425
|
+
if [ $WAIT_TIME -gt 60 ]; then
|
|
426
|
+
WAIT_TIME=60
|
|
427
|
+
fi
|
|
428
|
+
|
|
429
|
+
if [ $ATTEMPT -gt 1 ]; then
|
|
430
|
+
echo "Attempt $ATTEMPT/$MAX_ATTEMPTS: Waiting ${WAIT_TIME}s before retry..."
|
|
431
|
+
sleep $WAIT_TIME
|
|
432
|
+
else
|
|
433
|
+
echo "Attempt $ATTEMPT/$MAX_ATTEMPTS: Initial wait ${WAIT_TIME}s..."
|
|
434
|
+
sleep $WAIT_TIME
|
|
435
|
+
fi
|
|
436
|
+
|
|
437
|
+
if npm view httpcat-cli@$VERSION version > /dev/null 2>&1; then
|
|
438
|
+
echo "✅ Successfully verified httpcat-cli@$VERSION is available on npm"
|
|
439
|
+
exit 0
|
|
440
|
+
else
|
|
441
|
+
echo "⚠️ Package not yet available on npm CDN (attempt $ATTEMPT/$MAX_ATTEMPTS)"
|
|
442
|
+
fi
|
|
443
|
+
|
|
444
|
+
ATTEMPT=$((ATTEMPT + 1))
|
|
445
|
+
done
|
|
446
|
+
|
|
447
|
+
echo "❌ Failed to verify npm publication after $MAX_ATTEMPTS attempts"
|
|
448
|
+
echo "Package may still be propagating. Check manually: npm view httpcat-cli@$VERSION"
|
|
449
|
+
exit 1
|
|
271
450
|
|
|
272
451
|
# Job 4: Update Homebrew formula
|
|
273
452
|
update-homebrew:
|
|
@@ -275,10 +454,12 @@ jobs:
|
|
|
275
454
|
runs-on: ubuntu-latest
|
|
276
455
|
needs: [prepare, publish-npm]
|
|
277
456
|
steps:
|
|
278
|
-
- name: Checkout
|
|
279
|
-
uses: actions/checkout@
|
|
457
|
+
- name: Checkout homebrew tap
|
|
458
|
+
uses: actions/checkout@v6
|
|
280
459
|
with:
|
|
460
|
+
repository: hathbanger/homebrew-httpcat
|
|
281
461
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
462
|
+
path: homebrew-tap
|
|
282
463
|
|
|
283
464
|
- name: Wait for npm CDN propagation
|
|
284
465
|
run: |
|
|
@@ -298,7 +479,7 @@ jobs:
|
|
|
298
479
|
run: |
|
|
299
480
|
VERSION="${{ needs.prepare.outputs.version }}"
|
|
300
481
|
TARBALL_URL="https://registry.npmjs.org/httpcat-cli/-/httpcat-cli-${VERSION}.tgz"
|
|
301
|
-
|
|
482
|
+
|
|
302
483
|
echo "Downloading tarball to calculate SHA256..."
|
|
303
484
|
curl -L -o package.tgz "$TARBALL_URL"
|
|
304
485
|
SHA256=$(shasum -a 256 package.tgz | cut -d' ' -f1)
|
|
@@ -309,28 +490,29 @@ jobs:
|
|
|
309
490
|
run: |
|
|
310
491
|
VERSION="${{ needs.prepare.outputs.version }}"
|
|
311
492
|
SHA256="${{ steps.npm-sha.outputs.sha256 }}"
|
|
312
|
-
FORMULA_FILE="homebrew-
|
|
313
|
-
|
|
493
|
+
FORMULA_FILE="homebrew-tap/Formula/httpcat.rb"
|
|
494
|
+
|
|
314
495
|
# Update version
|
|
315
496
|
sed -i.bak "s|url \".*httpcat-cli-.*\.tgz\"|url \"https://registry.npmjs.org/httpcat-cli/-/httpcat-cli-${VERSION}.tgz\"|" "$FORMULA_FILE"
|
|
316
|
-
|
|
497
|
+
|
|
317
498
|
# Update SHA256
|
|
318
499
|
sed -i.bak "s|sha256 \".*\"|sha256 \"${SHA256}\"|" "$FORMULA_FILE"
|
|
319
|
-
|
|
500
|
+
|
|
320
501
|
# Update test version
|
|
321
502
|
sed -i.bak "s|assert_match \".*\"|assert_match \"${VERSION}\"|" "$FORMULA_FILE"
|
|
322
|
-
|
|
503
|
+
|
|
323
504
|
rm -f "${FORMULA_FILE}.bak"
|
|
324
|
-
|
|
505
|
+
|
|
325
506
|
echo "✅ Updated Homebrew formula:"
|
|
326
507
|
cat "$FORMULA_FILE"
|
|
327
508
|
|
|
328
509
|
- name: Commit and push Homebrew formula update
|
|
329
510
|
run: |
|
|
511
|
+
cd homebrew-tap
|
|
330
512
|
git config user.name "github-actions[bot]"
|
|
331
513
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
332
|
-
git add
|
|
333
|
-
git commit -m "
|
|
514
|
+
git add Formula/httpcat.rb
|
|
515
|
+
git commit -m "Update httpcat to ${{ needs.prepare.outputs.version }}" || exit 0
|
|
334
516
|
git push
|
|
335
517
|
|
|
336
518
|
# Job 5: Create GitHub Release
|
|
@@ -342,7 +524,7 @@ jobs:
|
|
|
342
524
|
contents: write
|
|
343
525
|
steps:
|
|
344
526
|
- name: Create GitHub Release
|
|
345
|
-
uses: softprops/action-gh-release@
|
|
527
|
+
uses: softprops/action-gh-release@v2
|
|
346
528
|
with:
|
|
347
529
|
tag_name: ${{ needs.prepare.outputs.tag }}
|
|
348
530
|
name: Release ${{ needs.prepare.outputs.version }}
|