Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish npm package

on:
workflow_dispatch:

permissions:
contents: read

Comment on lines +1 to +8
jobs:
publish:
runs-on: ubuntu-latest
environment: npm
permissions:
contents: read
id-token: write
steps:
- name: Require the main branch
if: github.ref != 'refs/heads/main'
run: |
echo "Refusing to publish from $GITHUB_REF; dispatch this workflow from main."
exit 1

- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24

- name: Configure npm trusted publishing
run: |
npm install --global npm@12.0.2
npm config set registry https://registry.npmjs.org

- name: Verify package contents and installation
run: |
npm pack --dry-run --json
package_tarball="$(npm pack --pack-destination "$RUNNER_TEMP" --silent)"
install_dir="$(mktemp -d)"
npm install --ignore-scripts --prefix "$install_dir" "$RUNNER_TEMP/$package_tarball"
node -e "const p = require(process.argv[1]); if (p.name !== '@paadev/paa-contracts') process.exit(1)" \
"$install_dir/node_modules/@paadev/paa-contracts/package.json"
Comment on lines +41 to +43

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add the public-registry installation check.

This command installs the local tarball. It does not install @paadev/paa-contracts@0.1.0 from the public registry. npm treats a local tarball and a registry name@version spec as different inputs. (docs.npmjs.com)

Keep the local tarball check. Add a separate clean temporary-directory install of the exact public package. Run it before publication when version 0.1.0 already exists. Otherwise, run it after publication with retry handling for registry propagation.

Suggested public installation check
       - name: Publish package
         run: npm publish --access public
+
+      - name: Verify public installation
+        run: |
+          public_install_dir="$(mktemp -d)"
+          npm install --ignore-scripts --prefer-online \
+            --registry https://registry.npmjs.org \
+            --prefix "$public_install_dir" \
+            '`@paadev/paa-contracts`@0.1.0'
+          node -e "const p = require(process.argv[1]); if (p.name !== '`@paadev/paa-contracts`' || p.version !== '0.1.0') process.exit(1)" \
+            "$public_install_dir/node_modules/@paadev/paa-contracts/package.json"
🧰 Tools
🪛 zizmor (1.29.0)

[warning] 41-41: ad-hoc installation of packages (adhoc-packages): installs a package outside of a lockfile

(adhoc-packages)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish-npm.yml around lines 41 - 43, Update the publish
workflow around the existing local tarball installation and package.json
validation to add a separate clean temporary-directory install of the exact
public package spec `@paadev/paa-contracts`@0.1.0. Run this registry check before
publishing when that version already exists; otherwise run it after publication
with retry handling for registry propagation, while preserving the existing
local tarball check.


- name: Publish package
run: npm publish --access public
Comment on lines +45 to +46
Comment thread
coderabbitai[bot] marked this conversation as resolved.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@rankonelabs/paa-contracts",
"name": "@paadev/paa-contracts",
"version": "0.1.0",
"description": "Published contract artifacts of the Progressive Autonomy Architecture: four normative JSON Schemas, the positive fixture corpus every implementation is checked against, and the table-driven invalid-case matrices.",
"license": "MIT",
Expand Down
Loading