httpcat-cli 0.0.27-rc.2 → 0.0.27-rc.4

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.
@@ -11,9 +11,23 @@ Continuous Integration workflow that runs on every push and pull request:
11
11
  - Security audits
12
12
  - Code coverage reporting
13
13
 
14
+ ### `publish-switch.yml`
15
+ Entry point workflow for npm trusted publishing (OIDC). This is the workflow that npm validates against.
16
+ - Routes to either `rc-publish.yml` (for develop branch) or `release.yml` (for main branch/tags)
17
+ - Contains OIDC permissions required for trusted publishing
18
+ - This is the workflow file that must be configured in npm's Trusted Publishers settings
19
+
20
+ ### `rc-publish.yml`
21
+ Reusable workflow for publishing Release Candidate versions:
22
+ - Called by `publish-switch.yml` when pushing to `develop` branch
23
+ - Automatically increments RC version number
24
+ - Publishes to npm with `rc` tag
25
+ - Does not create GitHub releases
26
+
14
27
  ### `release.yml`
15
- Automated release workflow that:
16
- - Triggers on version tags (v*.*.*) or manual dispatch
28
+ Reusable workflow for publishing official releases:
29
+ - Called by `publish-switch.yml` when pushing to `main` branch or version tags
30
+ - Auto-detects version bump from conventional commits (BREAKING/feat/fix)
17
31
  - Validates version format
18
32
  - Runs tests and builds
19
33
  - Publishes to npm
@@ -35,10 +49,12 @@ Manual workflow to update the Homebrew formula in the tap repository.
35
49
  4. Select **"GitHub Actions"**
36
50
  5. Configure:
37
51
  - **Repository**: `hathbanger/httpcat-cli`
38
- - **Workflow file**: `.github/workflows/rc-publish.yml` (for RC) or `.github/workflows/release.yml` (for releases)
52
+ - **Workflow file**: `.github/workflows/publish-switch.yml` (this is the entry point that routes to RC or release)
39
53
  - **Environment name**: `npm-publish` (optional, if using environments)
40
54
  6. Save the configuration
41
55
 
56
+ **Important:** Only `publish-switch.yml` needs to be configured as the trusted publisher. It will automatically route to the correct workflow (RC or release) based on the trigger.
57
+
42
58
  **Benefits:**
43
59
  - ✅ No tokens needed - uses OIDC authentication
44
60
  - ✅ Bypasses 2FA requirements automatically
@@ -0,0 +1,41 @@
1
+ name: Publish Switch
2
+
3
+ # This is the entry point workflow that npm will trust for OIDC publishing
4
+ # It conditionally calls either the RC or Release workflow based on the trigger
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - develop # RC publishing
10
+ - main # Release publishing
11
+ tags:
12
+ - "v*.*.*" # Release publishing via tags
13
+ workflow_dispatch:
14
+ inputs:
15
+ version:
16
+ description: "Version to release (e.g., 1.2.3). Leave empty for auto-detection from commits."
17
+ required: false
18
+ type: string
19
+
20
+ permissions:
21
+ id-token: write # Required for OIDC to request ID token to authenticate workflow
22
+ contents: write # Required for creating tags and releases
23
+
24
+ jobs:
25
+ publish-rc:
26
+ if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
27
+ uses: ./.github/workflows/rc-publish.yml
28
+ permissions:
29
+ id-token: write
30
+ contents: read
31
+
32
+ publish-release:
33
+ if: |
34
+ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))) ||
35
+ github.event_name == 'workflow_dispatch'
36
+ uses: ./.github/workflows/release.yml
37
+ with:
38
+ version: ${{ github.event.inputs.version }}
39
+ permissions:
40
+ id-token: write
41
+ contents: write
@@ -1,9 +1,9 @@
1
1
  name: RC Publish
2
2
 
3
+ # This is a reusable workflow called by publish-switch.yml
3
4
  on:
4
- push:
5
- branches:
6
- - develop
5
+ workflow_call:
6
+ # No inputs needed for RC publishing
7
7
 
8
8
  env:
9
9
  NODE_VERSION: "20"
@@ -152,14 +152,41 @@ jobs:
152
152
 
153
153
  - name: Verify npm publication
154
154
  run: |
155
- sleep 5 # Wait for npm CDN propagation
156
155
  VERSION="${{ needs.prepare.outputs.version }}"
157
- if npm view httpcat-cli@$VERSION version > /dev/null 2>&1; then
158
- echo "✅ Successfully published httpcat-cli@$VERSION to npm (rc tag)"
159
- else
160
- echo "❌ Failed to verify npm publication"
161
- exit 1
162
- fi
156
+ MAX_ATTEMPTS=10
157
+ INITIAL_WAIT=5
158
+ ATTEMPT=1
159
+
160
+ echo "Waiting for npm CDN propagation for httpcat-cli@$VERSION..."
161
+
162
+ while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
163
+ # Exponential backoff: 5s, 10s, 20s, 40s, etc. (capped at 60s)
164
+ WAIT_TIME=$((INITIAL_WAIT * (2 ** (ATTEMPT - 1))))
165
+ if [ $WAIT_TIME -gt 60 ]; then
166
+ WAIT_TIME=60
167
+ fi
168
+
169
+ if [ $ATTEMPT -gt 1 ]; then
170
+ echo "Attempt $ATTEMPT/$MAX_ATTEMPTS: Waiting ${WAIT_TIME}s before retry..."
171
+ sleep $WAIT_TIME
172
+ else
173
+ echo "Attempt $ATTEMPT/$MAX_ATTEMPTS: Initial wait ${WAIT_TIME}s..."
174
+ sleep $WAIT_TIME
175
+ fi
176
+
177
+ if npm view httpcat-cli@$VERSION version > /dev/null 2>&1; then
178
+ echo "✅ Successfully verified httpcat-cli@$VERSION is available on npm (rc tag)"
179
+ exit 0
180
+ else
181
+ echo "⚠️ Package not yet available on npm CDN (attempt $ATTEMPT/$MAX_ATTEMPTS)"
182
+ fi
183
+
184
+ ATTEMPT=$((ATTEMPT + 1))
185
+ done
186
+
187
+ echo "❌ Failed to verify npm publication after $MAX_ATTEMPTS attempts"
188
+ echo "Package may still be propagating. Check manually: npm view httpcat-cli@$VERSION"
189
+ exit 1
163
190
 
164
191
  - name: RC summary
165
192
  run: |
@@ -1,12 +1,8 @@
1
1
  name: Release
2
2
 
3
+ # This is a reusable workflow called by publish-switch.yml
3
4
  on:
4
- push:
5
- branches:
6
- - main
7
- tags:
8
- - "v*.*.*" # Triggers on semantic version tags (e.g., v1.2.3)
9
- workflow_dispatch:
5
+ workflow_call:
10
6
  inputs:
11
7
  version:
12
8
  description: "Version to release (e.g., 1.2.3). Leave empty for auto-detection from commits."
@@ -52,9 +48,12 @@ jobs:
52
48
 
53
49
  let version;
54
50
 
55
- if (context.eventName === 'workflow_dispatch' && context.payload.inputs.version) {
56
- // Manual workflow dispatch with version provided
57
- version = context.payload.inputs.version.replace(/^v/, '');
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}`);
58
57
  } else if (context.ref.startsWith('refs/tags/')) {
59
58
  // Tag-based release
60
59
  version = context.ref.replace('refs/tags/v', '');
@@ -412,14 +411,41 @@ jobs:
412
411
 
413
412
  - name: Verify npm publication
414
413
  run: |
415
- sleep 5 # Wait for npm CDN propagation
416
414
  VERSION="${{ needs.prepare.outputs.version }}"
417
- if npm view httpcat-cli@$VERSION version > /dev/null 2>&1; then
418
- echo "✅ Successfully published httpcat-cli@$VERSION to npm"
419
- else
420
- echo "❌ Failed to verify npm publication"
421
- exit 1
422
- fi
415
+ MAX_ATTEMPTS=10
416
+ INITIAL_WAIT=5
417
+ ATTEMPT=1
418
+
419
+ echo "Waiting for npm CDN propagation for httpcat-cli@$VERSION..."
420
+
421
+ while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
422
+ # Exponential backoff: 5s, 10s, 20s, 40s, etc. (capped at 60s)
423
+ WAIT_TIME=$((INITIAL_WAIT * (2 ** (ATTEMPT - 1))))
424
+ if [ $WAIT_TIME -gt 60 ]; then
425
+ WAIT_TIME=60
426
+ fi
427
+
428
+ if [ $ATTEMPT -gt 1 ]; then
429
+ echo "Attempt $ATTEMPT/$MAX_ATTEMPTS: Waiting ${WAIT_TIME}s before retry..."
430
+ sleep $WAIT_TIME
431
+ else
432
+ echo "Attempt $ATTEMPT/$MAX_ATTEMPTS: Initial wait ${WAIT_TIME}s..."
433
+ sleep $WAIT_TIME
434
+ fi
435
+
436
+ if npm view httpcat-cli@$VERSION version > /dev/null 2>&1; then
437
+ echo "✅ Successfully verified httpcat-cli@$VERSION is available on npm"
438
+ exit 0
439
+ else
440
+ echo "⚠️ Package not yet available on npm CDN (attempt $ATTEMPT/$MAX_ATTEMPTS)"
441
+ fi
442
+
443
+ ATTEMPT=$((ATTEMPT + 1))
444
+ done
445
+
446
+ echo "❌ Failed to verify npm publication after $MAX_ATTEMPTS attempts"
447
+ echo "Package may still be propagating. Check manually: npm view httpcat-cli@$VERSION"
448
+ exit 1
423
449
 
424
450
  # Job 4: Update Homebrew formula
425
451
  update-homebrew:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "httpcat-cli",
3
- "version": "0.0.27-rc.2",
3
+ "version": "0.0.27-rc.4",
4
4
  "description": "CLI tool for interacting with httpcat agent - create, buy, and sell tokens with x402 payments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {