Skip to content

Commit

Permalink
Fix release script attempting to push to Yarn registry for setting ta…
Browse files Browse the repository at this point in the history
…gs (#236)

## Summary

The release script in #224 and #230 almost worked.

We see in run to release a `v1.x` backport that the following command
failed:

https://github.com/inngest/inngest-js/actions/runs/5244055017/jobs/9469531269
```
$ npm dist-tag add inngest@2.0.1 latest

npm ERR! code E401
npm ERR! 401 Unauthorized - PUT https://registry.yarnpkg.com/-/package/inngest/dist-tags/latest
```

Looks like it's defaulting to using Yarn's registry URL instsead of
npm's. We get around this during publishing as we specify
`publishConfig.registry` in our `package.json`, but it seems that `npm
dist-tag` doesn't obey this same property.

Let's manually set the registry for this particular command to ensure it
tries to affect the right place.

## Related

- #224
- #230

(cherry picked from commit f33464f)
  • Loading branch information
jpwilliams authored and github-actions[bot] committed Jun 12, 2023
1 parent 8381746 commit 6d4874a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (branch !== "main" && !branch.endsWith(".x")) {

console.log("branch:", branch);

const { version } = require("../package.json");
const { version, publishConfig: { registry } } = require("../package.json");
console.log("version:", version);
const tag = `v${version}`;
console.log("tag:", tag);
Expand Down Expand Up @@ -93,11 +93,15 @@ const exec = async (...args) => {
latestVersion,
);

// `npm dist-tag` doesn't obey `publishConfig.registry`, so we must
// explicitly pass the registry URL here
await exec("npm", [
"dist-tag",
"add",
`inngest@${latestVersion}`,
"latest",
"--registry",
registry,
]);
}

Expand Down

0 comments on commit 6d4874a

Please sign in to comment.