Skip to content

Commit 7a85f54

Browse files
committed
Update workflow & package
1 parent 8fa2247 commit 7a85f54

3 files changed

Lines changed: 201 additions & 68 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 196 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99
inputs:
1010
version:
11-
description: 'Version to publish (e.g., 0.1.1)'
11+
description: 'Version to publish (e.g., 1.0.0)'
1212
required: true
1313
type: string
1414
dry_run:
@@ -62,27 +62,37 @@ jobs:
6262
run: |
6363
echo "Checking build output..."
6464
if [ ! -f dist/index.js ]; then
65-
echo "Error: dist/index.js not found"
65+
echo "Error: dist/index.js not found"
6666
exit 1
6767
fi
6868
if [ ! -f dist/index.d.ts ]; then
69-
echo "Error: dist/index.d.ts not found"
69+
echo "Error: dist/index.d.ts not found"
7070
exit 1
7171
fi
72-
echo "Build output verified successfully"
72+
echo "Build output verified successfully"
7373
74-
- name: Check package contents
74+
- name: Verify package contents
7575
run: |
76-
echo "Creating package tarball for inspection..."
76+
echo "📦 Package contents preview:"
7777
npm pack --dry-run
7878
79-
echo "Package will include:"
80-
npm pack --dry-run 2>&1 | grep -E '^\s+' || true
79+
echo ""
80+
echo "📊 Verifying package size..."
81+
SIZE=$(npm pack --dry-run 2>&1 | grep "package size" | awk '{print $4, $5}')
82+
echo "Package size: $SIZE"
83+
84+
echo ""
85+
echo "🔍 Ensuring source files are excluded..."
86+
if npm pack --dry-run 2>&1 | grep -q "src/"; then
87+
echo "❌ ERROR: Source files detected in package!"
88+
exit 1
89+
fi
90+
echo "✅ Source files correctly excluded"
8191
8292
- name: Upload build artifacts
8393
uses: actions/upload-artifact@v4
8494
with:
85-
name: dist-files
95+
name: dist-files-${{ github.sha }}
8696
path: dist/
8797
retention-days: 7
8898

@@ -96,7 +106,7 @@ jobs:
96106
url: https://www.npmjs.com/package/@open-agent-economy/trust-sdk
97107
permissions:
98108
contents: read
99-
id-token: write
109+
id-token: write # Required for provenance
100110

101111
steps:
102112
- name: Checkout code
@@ -121,64 +131,121 @@ jobs:
121131
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
122132
VERSION="${{ inputs.version }}"
123133
else
124-
# Extract version from tag (v0.1.0 -> 0.1.0)
134+
# Extract version from tag (v1.0.0 -> 1.0.0)
125135
VERSION="${GITHUB_REF#refs/tags/v}"
126136
fi
127137
echo "version=$VERSION" >> $GITHUB_OUTPUT
128-
echo "Publishing version: $VERSION"
138+
echo "📌 Publishing version: $VERSION"
129139
130-
- name: Update package version
140+
- name: Verify version matches package.json
131141
run: |
132-
VERSION="${{ steps.version.outputs.version }}"
133-
npm version $VERSION --no-git-tag-version
134-
echo "Package version updated to $VERSION"
142+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
143+
TAG_VERSION="${{ steps.version.outputs.version }}"
144+
145+
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
146+
echo "⚠️ Version mismatch detected!"
147+
echo "package.json: $PACKAGE_VERSION"
148+
echo "Tag version: $TAG_VERSION"
149+
echo "Updating package.json to match tag..."
150+
npm version $TAG_VERSION --no-git-tag-version
151+
else
152+
echo "✅ Version matches: $PACKAGE_VERSION"
153+
fi
135154
136-
- name: Publish to NPM (with provenance)
155+
- name: Final package verification
137156
run: |
138-
echo "Publishing @open-agent-economy/trust-sdk@${{ steps.version.outputs.version }} with provenance..."
157+
echo "📋 Package information:"
158+
npm pack --dry-run
159+
160+
echo ""
161+
echo "🔍 Final checks:"
162+
163+
# Check version
164+
VERSION=$(node -p "require('./package.json').version")
165+
echo "✅ Version: $VERSION"
166+
167+
# Check main entry
168+
MAIN=$(node -p "require('./package.json').main")
169+
if [ -f "$MAIN" ]; then
170+
echo "✅ Main entry exists: $MAIN"
171+
else
172+
echo "❌ Main entry missing: $MAIN"
173+
exit 1
174+
fi
175+
176+
# Check types entry
177+
TYPES=$(node -p "require('./package.json').types")
178+
if [ -f "$TYPES" ]; then
179+
echo "✅ Types entry exists: $TYPES"
180+
else
181+
echo "❌ Types entry missing: $TYPES"
182+
exit 1
183+
fi
184+
185+
- name: Publish to NPM with Provenance
186+
run: |
187+
echo "🚀 Publishing @open-agent-economy/trust-sdk@${{ steps.version.outputs.version }}"
188+
echo "📝 With cryptographic provenance attestation..."
139189
npm publish --provenance --access public
140-
echo "Package published successfully with provenance!"
190+
echo "Package published successfully!"
141191
142192
- name: Verify publication
143193
run: |
144-
echo "Waiting 30 seconds for NPM registry to update..."
194+
echo "Waiting 30 seconds for NPM registry to update..."
145195
sleep 30
146196
147197
VERSION="${{ steps.version.outputs.version }}"
148-
echo "Verifying package @open-agent-economy/trust-sdk@$VERSION..."
198+
echo "🔍 Verifying package @open-agent-economy/trust-sdk@$VERSION..."
149199
150200
# Try to fetch package info from NPM
151201
if npm view @open-agent-economy/trust-sdk@$VERSION version; then
152-
echo "Package verified successfully on NPM registry!"
202+
echo "✅ Package verified on NPM registry!"
203+
204+
# Check provenance
205+
echo ""
206+
echo "🔐 Checking provenance..."
207+
npm view @open-agent-economy/trust-sdk@$VERSION --json | grep -q "attestations" && \
208+
echo "✅ Provenance attestation found!" || \
209+
echo "⚠️ Provenance attestation not yet available (may take a few minutes)"
153210
else
154-
echo "Warning: Could not verify package on NPM registry yet. Check manually."
211+
echo "⚠️ Could not verify package yet. Check manually at:"
212+
echo "https://www.npmjs.com/package/@open-agent-economy/trust-sdk/v/$VERSION"
155213
fi
156214
157215
- name: Create deployment summary
158216
run: |
159217
VERSION="${{ steps.version.outputs.version }}"
160-
cat >> $GITHUB_STEP_SUMMARY << EOF
161-
### Trust SDK Published Successfully! 🚀
162-
163-
**Package:** \`@open-agent-economy/trust-sdk\`
164-
**Version:** \`$VERSION\`
165-
**Registry:** NPM (public)
166-
**Commit:** \`${{ github.sha }}\`
167-
**Published at:** $(date -u)
168-
169-
#### Links
170-
- 📦 [NPM Package](https://www.npmjs.com/package/@open-agent-economy/trust-sdk)
171-
- 📊 [Package Page](https://www.npmjs.com/package/@open-agent-economy/trust-sdk/v/$VERSION)
172-
- 📝 [Repository](https://github.com/Open-Agent-Economy/open-agent-trust)
173-
174-
#### Installation
175-
\`\`\`bash
176-
npm install @open-agent-economy/trust-sdk@$VERSION
177-
\`\`\`
178-
179-
\`\`\`bash
218+
cat >> $GITHUB_STEP_SUMMARY << 'EOF'
219+
## 🚀 Trust SDK Published Successfully!
220+
221+
### Package Information
222+
- **Package:** `@open-agent-economy/trust-sdk`
223+
- **Version:** `${{ steps.version.outputs.version }}`
224+
- **Registry:** NPM (public)
225+
- **Provenance:** ✅ Enabled
226+
- **Commit:** `${{ github.sha }}`
227+
- **Published:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')
228+
229+
### 📦 Links
230+
- [NPM Package](https://www.npmjs.com/package/@open-agent-economy/trust-sdk)
231+
- [This Version](https://www.npmjs.com/package/@open-agent-economy/trust-sdk/v/${{ steps.version.outputs.version }})
232+
- [Documentation](https://open-agent-economy.github.io/open-agent-trust/)
233+
- [Repository](https://github.com/Open-Agent-Economy/open-agent-trust)
234+
235+
### 💻 Installation
236+
```bash
237+
npm install @open-agent-economy/trust-sdk@${{ steps.version.outputs.version }}
238+
```
239+
240+
Or install latest:
241+
```bash
180242
npm install @open-agent-economy/trust-sdk@latest
181-
\`\`\`
243+
```
244+
245+
### 🔐 Verify Provenance
246+
```bash
247+
npm audit signatures
248+
```
182249
EOF
183250
184251
create-release:
@@ -211,14 +278,15 @@ jobs:
211278
PREV_TAG=$(git rev-list --max-parents=0 HEAD)
212279
fi
213280
echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT
281+
echo "Previous tag: $PREV_TAG"
214282
215283
- name: Generate changelog
216284
id: changelog
217285
run: |
218286
PREV_TAG="${{ steps.prev_tag.outputs.prev_tag }}"
219287
CURRENT_TAG="${{ steps.version.outputs.tag }}"
220288
221-
echo "Generating changelog from $PREV_TAG to $CURRENT_TAG..."
289+
echo "📝 Generating changelog from $PREV_TAG to $CURRENT_TAG..."
222290
223291
# Generate commit list
224292
if [ "$PREV_TAG" = "$(git rev-list --max-parents=0 HEAD)" ]; then
@@ -233,8 +301,7 @@ jobs:
233301
234302
# Save to file for multiline output
235303
echo "$CHANGELOG" > changelog.txt
236-
237-
echo "Changelog generated successfully"
304+
echo "✅ Changelog generated"
238305
239306
- name: Create GitHub Release
240307
uses: actions/github-script@v7
@@ -250,20 +317,37 @@ jobs:
250317
251318
const isPrerelease = version.includes('-');
252319
253-
const body = `## Trust SDK v${version}
320+
const body = `## 🚀 Trust SDK v${version}
254321
255322
### What's Changed
256323
${changelog}
257324
258-
### Installation
325+
### 📦 Installation
259326
\`\`\`bash
260327
npm install @open-agent-economy/trust-sdk@${version}
261328
\`\`\`
262329
263-
### Links
330+
### 🔐 Security
331+
This release includes cryptographic provenance attestation. Verify with:
332+
\`\`\`bash
333+
npm audit signatures
334+
\`\`\`
335+
336+
### 📚 Documentation
337+
- [Full Documentation](https://open-agent-economy.github.io/open-agent-trust/)
338+
- [Getting Started](https://open-agent-economy.github.io/open-agent-trust/guide/getting-started)
339+
- [API Reference](https://open-agent-economy.github.io/open-agent-trust/api/sdk-reference)
340+
341+
### 🔗 Links
264342
- 📦 [NPM Package](https://www.npmjs.com/package/@open-agent-economy/trust-sdk/v/${version})
265-
- 📖 [Documentation](https://github.com/Open-Agent-Economy/open-agent-trust#readme)
343+
- 📖 [Documentation](https://open-agent-economy.github.io/open-agent-trust/)
266344
- 🐛 [Report Issues](https://github.com/Open-Agent-Economy/open-agent-trust/issues)
345+
- 💬 [Discussions](https://github.com/Open-Agent-Economy/open-agent-trust/discussions)
346+
347+
### 🌐 Deployment (Base Sepolia)
348+
- Interaction Registry: \`0x12F5C3fD1893bf9b2DeaA43AE1A2CCb122C3E707\`
349+
- Attestation Registry: \`0x64DaE82fE64D2fE96f90017FE51069C107BFe9d5\`
350+
- Trust Graph: \`0x8DC39B04A9C32e16DD7bd8906a8ea0d9DE6cCbDF\`
267351
`;
268352
269353
const release = await github.rest.repos.createRelease({
@@ -273,10 +357,11 @@ jobs:
273357
name: `Trust SDK v${version}`,
274358
body: body,
275359
draft: false,
276-
prerelease: isPrerelease
360+
prerelease: isPrerelease,
361+
generate_release_notes: false
277362
});
278363
279-
console.log(`Release created: ${release.data.html_url}`);
364+
console.log(`Release created: ${release.data.html_url}`);
280365
281366
dry-run:
282367
name: Dry Run (No Publish)
@@ -302,20 +387,70 @@ jobs:
302387

303388
- name: Dry run publish
304389
run: |
305-
echo "Running dry-run publish (no actual publication)..."
390+
echo "🧪 Running dry-run publish (no actual publication)..."
391+
echo ""
306392
npm publish --dry-run
307-
echo "Dry run completed successfully!"
393+
echo ""
394+
echo "✅ Dry run completed successfully!"
395+
396+
- name: Verify package contents
397+
run: |
398+
echo "📦 Creating actual tarball for inspection..."
399+
npm pack
400+
401+
TARBALL=$(ls *.tgz)
402+
echo "📋 Tarball: $TARBALL"
403+
404+
echo ""
405+
echo "📂 Contents:"
406+
tar -tzf $TARBALL
407+
408+
echo ""
409+
echo "🔍 Checking for unwanted files..."
410+
if tar -tzf $TARBALL | grep -q "src/"; then
411+
echo "❌ WARNING: Source files found in package!"
412+
else
413+
echo "✅ No source files in package"
414+
fi
415+
416+
if tar -tzf $TARBALL | grep -q "\.ts$" | grep -v "\.d\.ts$"; then
417+
echo "❌ WARNING: TypeScript source files found!"
418+
else
419+
echo "✅ No TypeScript source files"
420+
fi
421+
422+
# Cleanup
423+
rm $TARBALL
308424
309425
- name: Create summary
310426
run: |
311-
cat >> $GITHUB_STEP_SUMMARY << EOF
312-
### Dry Run Completed Successfully
427+
cat >> $GITHUB_STEP_SUMMARY << 'EOF'
428+
##Dry Run Completed Successfully
313429
314430
The package build and validation completed without errors.
315431
316-
**No package was published to NPM** (dry run mode).
432+
### ⚠️ No Package Published
433+
This was a **dry run** - nothing was published to NPM.
434+
435+
### 📊 Package Information
436+
- **Version:** `${{ inputs.version }}`
437+
- **Package:** `@open-agent-economy/trust-sdk`
438+
- **Node Version:** `${{ env.NODE_VERSION }}`
439+
440+
### 🚀 To Publish For Real
441+
442+
**Option 1: Via Git Tag**
443+
```bash
444+
git tag v${{ inputs.version }}
445+
git push origin v${{ inputs.version }}
446+
```
447+
448+
**Option 2: Manual Workflow**
449+
Run this workflow again with dry-run disabled.
317450
318-
To publish for real, either:
319-
1. Push a tag: \`git tag v${{ inputs.version }} && git push origin v${{ inputs.version }}\`
320-
2. Run this workflow again without dry-run enabled
451+
### ✅ Validation Passed
452+
- Build completed successfully
453+
- Package contents verified
454+
- Source files excluded
455+
- TypeScript definitions included
321456
EOF

0 commit comments

Comments
 (0)