Skip to content
Merged
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
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1040,11 +1040,42 @@ jobs:
- name: Update npm for OIDC support
run: npm install -g npm@latest

- name: Dry run SDK internal deps
if: github.event.inputs.dry_run == 'true'
run: |
set -euo pipefail
for package in config github-primitive workflow-types; do
echo "Dry run - would publish @agent-relay/${package}"
(cd "packages/${package}" && npm publish --dry-run --access public --tag ${{ github.event.inputs.tag }} --ignore-scripts)
done

- name: Dry run check
if: github.event.inputs.dry_run == 'true'
working-directory: packages/sdk
run: npm publish --dry-run --access public --tag ${{ github.event.inputs.tag }} --ignore-scripts

- name: Publish SDK internal deps to NPM
if: github.event.inputs.dry_run != 'true'
run: |
set -euo pipefail
VERSION="${{ needs.build.outputs.new_version }}"

publish_if_missing() {
local package="$1"
local name="@agent-relay/${package}"
if npm view "${name}@${VERSION}" version >/dev/null 2>&1; then
echo "✓ ${name}@${VERSION} is already published"
return
Comment on lines +1066 to +1068
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip SDK publish when version is already on npm

The new idempotency check only guards config, github-primitive, and workflow-types; the workflow still always runs npm publish for @agent-relay/sdk. In the exact recovery case this change targets (rerun with the same version after SDK was already published but an internal dep was missing), the internal dep can be repaired but the job still fails at SDK publish because npm rejects republishing an existing name/version. Add the same existence check (or a dist-tag update path) for SDK so reruns can complete successfully.

Useful? React with 👍 / 👎.

fi

echo "Publishing ${name}@${VERSION}"
(cd "packages/${package}" && npm publish --access public --provenance --tag ${{ github.event.inputs.tag }} --ignore-scripts)
}

publish_if_missing config
publish_if_missing workflow-types
Comment thread
khaliqgant marked this conversation as resolved.
publish_if_missing github-primitive

- name: Publish SDK to NPM
if: github.event.inputs.dry_run != 'true'
working-directory: packages/sdk
Expand Down
Loading