Configures DevClaw package for publishing to npm registry with automated GitHub Actions workflow and comprehensive publishing documentation. Changes: 1. package.json: - Added publishConfig with access: public (required for scoped packages) - Already has correct name: @openclaw/devclaw - Version: 0.1.0 (ready for initial release) - Files array properly configured (dist/, roles/, docs/) - prepublishOnly script ensures build before publish 2. GitHub Actions Workflow (.github/workflows/npm-publish.yml): - Triggers on release publication - Manual workflow dispatch option with tag input - Uses NPM_ACCESS_TOKEN secret for authentication - Includes npm provenance for supply chain security - Publishes as public package - Provides summary output after publication 3. Publishing Documentation (PUBLISHING.md): - Comprehensive guide for all publishing methods - Automated publishing via GitHub releases (recommended) - Manual workflow trigger instructions - Local publishing fallback - Dry-run testing procedures - Version management guidelines - Troubleshooting common issues - Post-publishing checklist Configuration Details: - Package name: @openclaw/devclaw (scoped) - npm account: laurentenhoor - Access: public (free for scoped packages) - Provenance: enabled for transparency - Node.js: >=20 required Ready for Initial Release: To publish the first version: 1. Verify NPM_ACCESS_TOKEN is set in GitHub secrets 2. Create and push tag: git tag v0.1.0 && git push --tags 3. Create GitHub release from tag 4. Workflow automatically builds and publishes to npm Addresses issue #130
50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
name: Publish to npm
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Tag to publish (e.g., v0.1.0)'
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
id-token: write # For npm provenance
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.release.tag_name || inputs.tag }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Publish to npm
|
|
run: npm publish --provenance --access public
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
|
|
|
|
- name: Publish summary
|
|
run: |
|
|
echo "## ✅ Published to npm" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Package:** \`@openclaw/devclaw\`" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Version:** \`$(node -p "require('./package.json').version")\`" >> $GITHUB_STEP_SUMMARY
|
|
echo "**URL:** https://www.npmjs.com/package/@openclaw/devclaw" >> $GITHUB_STEP_SUMMARY
|