@@ -216,24 +216,56 @@ jobs:
216216 with :
217217 node-version : ' 20'
218218
219+ - name : Get NPM token from AWS Secrets Manager
220+ run : |
221+ NPM_TOKEN=$(aws secretsmanager get-secret-value --secret-id NPM-TOKEN --region eu-north-1 --query SecretString --output text | jq -r .token)
222+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
223+ echo "registry=https://registry.npmjs.org/" >> ~/.npmrc
224+ echo "Authenticated as: $(npm whoami)"
225+
219226 - name : Test Release Publishing
220227 if : github.event.inputs.test_mode == 'release' || github.ref == 'refs/heads/fabisev/artifact-publishing'
221228 run : |
222- echo "=== TESTING RELEASE PUBLISHING (DRY RUN) ==="
223- echo "Would create a GitHub release with the following files:"
224- ls -la aws-lambda-ric-*.tgz checksums.*
225- echo "\nRelease would include version: ${{ needs.build.outputs.version }}"
229+ echo "=== TESTING RELEASE PUBLISHING ==="
230+ # Extract and modify package for testing
231+ tar -xzf aws-lambda-ric-*.tgz
232+ cd package
233+
234+ # Use a simple package name to avoid spam detection
235+ RANDOM_ID=$(openssl rand -hex 6)
236+ PACKAGE_NAME="fabisev-test-pkg-${RANDOM_ID}"
237+ npm pkg set name="${PACKAGE_NAME}"
238+
239+ echo "Package name: ${PACKAGE_NAME}"
240+ echo "Publishing to npm with version: ${{ needs.build.outputs.version }}"
241+
242+ # Try to publish and capture error details
243+ if ! npm publish --access public; then
244+ echo "❌ Publish failed, showing debug logs:"
245+ echo "=== NPM DEBUG LOG ==="
246+ find /root/.npm/_logs -name "*debug*.log" -exec cat {} \; 2>/dev/null || echo "No debug logs found"
247+ echo "=== END DEBUG LOG ==="
248+ exit 1
249+ fi
250+
251+ echo "✅ Successfully published test package to npm!"
226252
227253 - name : Test RC Publishing
228254 if : github.event.inputs.test_mode == 'rc'
229255 run : |
230- echo "=== TESTING RC PUBLISHING (DRY RUN) ==="
256+ echo "=== TESTING RC PUBLISHING ==="
257+ # Extract and modify package for testing
258+ tar -xzf aws-lambda-ric-*.tgz
259+ cd package
260+ # Use a completely random package name to avoid conflicts
261+ RANDOM_ID=$(openssl rand -hex 8)
262+ TIMESTAMP=$(date +%s)
263+ npm pkg set name="test-lambda-ric-${RANDOM_ID}-${TIMESTAMP}"
231264 # Simulate RC version
232265 RC_NUMBER="1"
233266 PACKAGE_VERSION="${{ needs.build.outputs.version }}-rc.${RC_NUMBER}"
234- echo "Would create a GitHub pre-release with the following files:"
235- ls -la aws-lambda-ric-*.tgz checksums.*
236- echo "\nRelease would include version: ${PACKAGE_VERSION}"
237-
238- # Update version for display purposes
239- npm version ${PACKAGE_VERSION} --no-git-tag-version
267+ echo "Publishing RC to npm with version: ${PACKAGE_VERSION}"
268+ # Update version for RC
269+ npm version ${PACKAGE_VERSION} --no-git-tag-version
270+ npm publish --tag rc --access public
271+ echo "✅ Successfully published RC test package to npm!"
0 commit comments