@@ -19,17 +19,60 @@ jobs:
1919 steps :
2020 - uses : actions/checkout@v4
2121
22+ - name : Initialize Workflow Report
23+ run : |
24+ echo "📋 Initializing NPM Publish Report..."
25+ mkdir -p workflow-reports
26+
27+ # Create report header
28+ cat > workflow-reports/npm-publish-report.md << 'EOF'
29+ # NPM Publish Workflow Report
30+
31+ ## Workflow Information
32+ - **Run ID**: ${{ github.run_id }}
33+ - **Run Number**: ${{ github.run_number }}
34+ - **Actor**: ${{ github.actor }}
35+ - **Event**: ${{ github.event_name }}
36+ - **Repository**: ${{ github.repository }}
37+ - **Branch**: ${{ github.ref_name }}
38+ - **Commit SHA**: ${{ github.sha }}
39+ - **Timestamp**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')
40+ - **Runner OS**: ${{ runner.os }}
41+
42+ ## Workflow Steps
43+
44+ EOF
45+
46+ echo "✅ Report initialized" >> workflow-reports/npm-publish-report.md
47+
2248 - uses : actions/setup-node@v4
2349 with :
2450 node-version : ' 20'
2551 registry-url : ' https://registry.npmjs.org'
2652
53+ - name : Report Node.js Setup
54+ run : |
55+ echo "" >> workflow-reports/npm-publish-report.md
56+ echo "### 🟢 Node.js Setup" >> workflow-reports/npm-publish-report.md
57+ echo "- **Node Version**: $(node --version)" >> workflow-reports/npm-publish-report.md
58+ echo "- **NPM Version**: $(npm --version)" >> workflow-reports/npm-publish-report.md
59+ echo "- **Registry**: $(npm config get registry)" >> workflow-reports/npm-publish-report.md
60+ echo "- **Status**: ✅ Completed successfully" >> workflow-reports/npm-publish-report.md
61+
2762 - name : Configure AWS credentials
2863 uses : aws-actions/configure-aws-credentials@v4
2964 with :
3065 role-to-assume : ${{ vars.AWS_DEPLOYMENT_ROLE }}
3166 aws-region : us-east-1
3267
68+ - name : Report AWS Setup
69+ run : |
70+ echo "" >> workflow-reports/npm-publish-report.md
71+ echo "### 🔑 AWS Credentials Setup" >> workflow-reports/npm-publish-report.md
72+ echo "- **AWS Region**: us-east-1" >> workflow-reports/npm-publish-report.md
73+ echo "- **Role**: ${{ vars.AWS_DEPLOYMENT_ROLE }}" >> workflow-reports/npm-publish-report.md
74+ echo "- **Status**: ✅ AWS credentials configured" >> workflow-reports/npm-publish-report.md
75+
3376 - name : Retrieve or Store NPM Token
3477 id : npm-token
3578 run : |
@@ -63,18 +106,51 @@ jobs:
63106 fi
64107 fi
65108
109+ - name : Report NPM Token Retrieval
110+ run : |
111+ echo "" >> workflow-reports/npm-publish-report.md
112+ echo "### 🔐 NPM Token Management" >> workflow-reports/npm-publish-report.md
113+ if [ -z "${{ inputs.npm_token }}" ]; then
114+ echo "- **Source**: SSM Parameter Store" >> workflow-reports/npm-publish-report.md
115+ else
116+ echo "- **Source**: Workflow Input" >> workflow-reports/npm-publish-report.md
117+ fi
118+ echo "- **Parameter**: /npm/tokens/PaulDuvall-claude-code" >> workflow-reports/npm-publish-report.md
119+ echo "- **Status**: ✅ NPM token retrieved successfully" >> workflow-reports/npm-publish-report.md
120+
66121 - name : Configure NPM
67122 run : |
68123 npm config set //registry.npmjs.org/:_authToken=${{ steps.npm-token.outputs.token }}
69124 echo "::add-mask::${{ steps.npm-token.outputs.token }}"
125+
126+ - name : Report NPM Configuration
127+ run : |
128+ echo "" >> workflow-reports/npm-publish-report.md
129+ echo "### ⚙️ NPM Configuration" >> workflow-reports/npm-publish-report.md
130+ echo "- **Registry**: https://registry.npmjs.org" >> workflow-reports/npm-publish-report.md
131+ echo "- **Auth Token**: [MASKED]" >> workflow-reports/npm-publish-report.md
132+ echo "- **Status**: ✅ NPM configured for publishing" >> workflow-reports/npm-publish-report.md
70133
71134 - name : Verify NPM Authentication
72135 run : |
73136 echo "Verifying NPM authentication..."
74- npm whoami 2>/dev/null || echo "⚠️ Warning: Could not verify authentication"
137+ NPM_USER=$( npm whoami 2>/dev/null || echo "unknown")
75138 echo "Registry config:"
76139 npm config get registry
77140
141+ - name : Report NPM Authentication
142+ run : |
143+ echo "" >> workflow-reports/npm-publish-report.md
144+ echo "### 🔍 NPM Authentication Verification" >> workflow-reports/npm-publish-report.md
145+ NPM_USER=$(npm whoami 2>/dev/null || echo "unknown")
146+ if [ "$NPM_USER" != "unknown" ]; then
147+ echo "- **Authenticated User**: $NPM_USER" >> workflow-reports/npm-publish-report.md
148+ echo "- **Status**: ✅ Authentication verified" >> workflow-reports/npm-publish-report.md
149+ else
150+ echo "- **Status**: ⚠️ Could not verify authentication" >> workflow-reports/npm-publish-report.md
151+ fi
152+ echo "- **Registry**: $(npm config get registry)" >> workflow-reports/npm-publish-report.md
153+
78154 - name : Publish
79155 env :
80156 NODE_AUTH_TOKEN : ${{ steps.npm-token.outputs.token }}
@@ -84,6 +160,11 @@ jobs:
84160 echo "Current directory: $(pwd)"
85161 echo "Package name from package.json:"
86162 grep '"name"' package.json
163+
164+ # Capture package info for reporting
165+ PACKAGE_NAME=$(grep '"name"' package.json | sed 's/.*"name":\s*"\([^"]*\)".*/\1/')
166+ PACKAGE_VERSION=$(grep '"version"' package.json | sed 's/.*"version":\s*"\([^"]*\)".*/\1/')
167+
87168 npm publish --access public --verbose 2>&1 || {
88169 echo "❌ Publish failed. Common causes:"
89170 echo " 1. Token doesn't have publish permissions"
@@ -92,6 +173,21 @@ jobs:
92173 exit 1
93174 }
94175
176+ - name : Report Package Publishing
177+ run : |
178+ cd claude-dev-toolkit
179+ PACKAGE_NAME=$(grep '"name"' package.json | sed 's/.*"name":\s*"\([^"]*\)".*/\1/')
180+ PACKAGE_VERSION=$(grep '"version"' package.json | sed 's/.*"version":\s*"\([^"]*\)".*/\1/')
181+
182+ echo "" >> ../workflow-reports/npm-publish-report.md
183+ echo "### 📦 Package Publishing" >> ../workflow-reports/npm-publish-report.md
184+ echo "- **Package Name**: $PACKAGE_NAME" >> ../workflow-reports/npm-publish-report.md
185+ echo "- **Version**: $PACKAGE_VERSION" >> ../workflow-reports/npm-publish-report.md
186+ echo "- **Access**: public" >> ../workflow-reports/npm-publish-report.md
187+ echo "- **Registry**: https://registry.npmjs.org" >> ../workflow-reports/npm-publish-report.md
188+ echo "- **Status**: ✅ Package published successfully" >> ../workflow-reports/npm-publish-report.md
189+ echo "- **NPM URL**: https://www.npmjs.com/package/$PACKAGE_NAME" >> ../workflow-reports/npm-publish-report.md
190+
95191 - name : Verify SSM parameter (Optional)
96192 continue-on-error : true
97193 run : |
@@ -101,4 +197,34 @@ jobs:
101197 else
102198 echo "⚠️ SSM parameter not accessible (insufficient permissions or not created)"
103199 echo "To enable SSM access, add ssm:GetParameter permission to your IAM role"
104- fi
200+ fi
201+
202+ - name : Report SSM Verification
203+ continue-on-error : true
204+ run : |
205+ echo "" >> workflow-reports/npm-publish-report.md
206+ echo "### 🔒 SSM Parameter Verification" >> workflow-reports/npm-publish-report.md
207+ if aws ssm get-parameter --name "/npm/tokens/PaulDuvall-claude-code" --query 'Parameter.Name' --output text 2>/dev/null; then
208+ echo "- **Parameter**: /npm/tokens/PaulDuvall-claude-code" >> workflow-reports/npm-publish-report.md
209+ echo "- **Status**: ✅ SSM parameter accessible" >> workflow-reports/npm-publish-report.md
210+ else
211+ echo "- **Parameter**: /npm/tokens/PaulDuvall-claude-code" >> workflow-reports/npm-publish-report.md
212+ echo "- **Status**: ⚠️ SSM parameter not accessible" >> workflow-reports/npm-publish-report.md
213+ fi
214+
215+ - name : Finalize Workflow Report
216+ run : |
217+ echo "" >> workflow-reports/npm-publish-report.md
218+ echo "### 🎉 Workflow Completion" >> workflow-reports/npm-publish-report.md
219+ echo "- **Completion Time**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> workflow-reports/npm-publish-report.md
220+ echo "- **Overall Status**: ✅ NPM publish workflow completed successfully" >> workflow-reports/npm-publish-report.md
221+ echo "" >> workflow-reports/npm-publish-report.md
222+ echo "---" >> workflow-reports/npm-publish-report.md
223+ echo "*Report generated automatically by GitHub Actions workflow*" >> workflow-reports/npm-publish-report.md
224+
225+ - name : Upload Workflow Report
226+ uses : actions/upload-artifact@v4
227+ with :
228+ name : npm-publish-report
229+ path : workflow-reports/npm-publish-report.md
230+ retention-days : 30
0 commit comments