dhoulb / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
202 stars 37 forks source link

Releasing from GitHub Actions npm ERR!! code ENEEDAUTH #82

Closed EricCrosson closed 2 years ago

EricCrosson commented 2 years ago

Hi, this is a cool package! I'm really excited to get it working

What I've done:

This is all visible here

What I expected to happen:

multi-semantic-release is able to publish npm packages to registry.npmjs.org

What actually happens:

I am consistently getting the same error,

npm ERR! code ENEEDAUTH
343
npm ERR! need auth This command requires you to be logged in.
344
npm ERR! need auth You need to authorize this machine using `npm adduser`

visible here: https://github.com/typescript-tools/typescript-tools/runs/3975804717?check_suite_focus=true

I've tried every variation of configuration I can imagine over the past day. Do you know what I'm doing wrong / do you have a working example I can compare against?

antongolub commented 2 years ago

Hey, @EricCrosson,

- name: Configure npm
        run: |
          echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
          cat .npmrc
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

It seems, that you pass secrets.NPM_TOKEN as env.NODE_AUTH_TOKEN, but your .npmrc refers to env.NPM_TOKEN which does not exist. I suggest you try _authToken=${NODE_AUTH_TOKEN} instead. Hope this helps.

UPD Here's how semrel npm plugin sets the token: https://github.com/semantic-release/npm/blob/7338fc25de82058ea83b1e6e6669707036c2d96a/lib/set-npmrc-auth.js#L41.

await outputFile(
      npmrc,
      `${currentConfig ? `${currentConfig}\n` : ''}${nerfDart(registry)}:_authToken = \${NPM_TOKEN}`
    );

It appends a new line with token to .npmrc, but the prev entry you added before will be used by npm (I'm just guessing).

EricCrosson commented 2 years ago

Hi @antongolub, thanks for the pointers :)

I think that was an artifact of 1 million trial runs, I currently have npm whoami working:

  npm whoami
  npx multi-semantic-release
  shell: /usr/bin/bash -e {0}
  env:
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX
    GITHUB_TOKEN: ***
    NPM_TOKEN: ***
hamroctopus

so I figure the npmrc is now configured correctly.

In response to your update -- so if I am understanding correctly, I should not need to configure the _autoToken manually in an npmrc file because semrel will generate its own config?

This seems to match several examples I found by digging through the "Used By" section on this project's readme -- there was nothing special I found in their github actions page, just a plain call to npm multi-semantic-release with an NPM_TOKEN and a GITHUB_TOKEN env var

UPDATE

When I remove my custom .npmrc file, I get the error

npm ERR! code E401
npm ERR! 401 Unauthorized - GET registry.npmjs.org/-/whoami

This is with an NPM_TOKEN secret I generated this morning with the command

npm login --scope=@typescript-tools --registry=https://registry.npmjs.org/
antongolub commented 2 years ago

Let's investigate what setup-node action does:

uses: actions/setup-node@v2
        with:
          node-version: 'lts/*'
          registry-url: https://registry.npmjs.org
          always-auth: true

When registry-url options is passed, it will be stored to .npmrc: https://github.com/actions/setup-node/blob/25316bbc1f10ac9d8798711f44914b1cf3c4e954/src/authutil.ts#L7

  // Remove http: or https: from front of registry.
  const authString: string =
    registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}';
  const registryString: string = scope
    ? `${scope}:registry=${registryUrl}`
    : `registry=${registryUrl}`;
  const alwaysAuthString: string = `always-auth=${alwaysAuth}`;
  newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;

For an experiment, I would suggest removing this setup-node option, and declare env.NPM_CONFIG_REGISTRY for release step if you need a custom value. Otherwise, npm plugin will set https://registry.npmjs.org by default. https://github.com/semantic-release/npm/blob/13200ca01814cab52bb4a8e5b63395c20b71240b/lib/get-registry.js

const path = require('path');
const rc = require('rc');
const getRegistryUrl = require('registry-auth-token/registry-url');

module.exports = ({publishConfig: {registry} = {}, name}, {cwd, env}) =>
  registry ||
  env.NPM_CONFIG_REGISTRY ||
  getRegistryUrl(
    name.split('/')[0],
    rc(
      'npm',
      {registry: 'https://registry.npmjs.org/'},
      {config: env.NPM_CONFIG_USERCONFIG || path.resolve(cwd, '.npmrc')}
    )
  );
antongolub commented 2 years ago

Here's a valid release config example for msr + gh-actions: https://github.com/qiwi/semantic-release-toolkit/blob/master/.github/workflows/ci.yaml

BTW FYI, unfortunately, different gh-actions files cannot cross-refer to their steps via needs directive. So if you'd like to run release after your tests, you should declare the entire flow in one plae. image

antongolub commented 2 years ago

@EricCrosson,

You can run msr locally for debug: NPM_TOKEN=foo GH_TOKEN=bar npx multi-semantic-release

EricCrosson commented 2 years ago

@antongolub, you have correctly assessed that I am new to GitHub Actions, thanks for linking to the qiki/semantic-release-toolkit which is a great example.

Unfortunately, the call to msr is a straightforward one! I still cannot discern what's going wrong on my end.

I am able to reproduce this error on my local workstation:

NPM_TOKEN=foo GITHUB_TOKEN=bar npx multi-semantic-release --dry-run
full output

``` multi-semantic-release version: 2.9.1 semantic-release version: 17.4.7 flags: { "dryRun": true, "sequentialInit": false, "firstParent": false, "debug": false, "deps": { "bump": "override", "release": "patch" }, "ignorePrivatePackages": false } package paths [ '/home/eric/workspace/github/typescript-tools/packages/configure-lerna-manifest/package.json', '/home/eric/workspace/github/typescript-tools/packages/containing-packages/package.json', '/home/eric/workspace/github/typescript-tools/packages/dependency-graph/package.json', '/home/eric/workspace/github/typescript-tools/packages/depender-graph/package.json', '/home/eric/workspace/github/typescript-tools/packages/find-package/package.json', '/home/eric/workspace/github/typescript-tools/packages/hoisted-package-json/package.json', '/home/eric/workspace/github/typescript-tools/packages/hoisted-packages/package.json', '/home/eric/workspace/github/typescript-tools/packages/internal-dependencies/package.json', '/home/eric/workspace/github/typescript-tools/packages/internal-dependers/package.json', '/home/eric/workspace/github/typescript-tools/packages/io-ts/package.json', '/home/eric/workspace/github/typescript-tools/packages/lerna-packages/package.json', '/home/eric/workspace/github/typescript-tools/packages/lerna-utils/package.json', '/home/eric/workspace/github/typescript-tools/packages/link-dependency-executables/package.json', '/home/eric/workspace/github/typescript-tools/packages/link-local-dependencies/package.json', '/home/eric/workspace/github/typescript-tools/packages/monorepo-root/package.json', '/home/eric/workspace/github/typescript-tools/packages/package-manifests/package.json', '/home/eric/workspace/github/typescript-tools/packages/packages-to-rebuild-on-changes/package.json', '/home/eric/workspace/github/typescript-tools/packages/packages-to-rebuild-on-changes-cli/package.json', '/home/eric/workspace/github/typescript-tools/packages/pin-lerna-package-versions/package.json', '/home/eric/workspace/github/typescript-tools/packages/stringify-json/package.json', '/home/eric/workspace/github/typescript-tools/packages/tsconfig-includes/package.json', '/home/eric/workspace/github/typescript-tools/packages/typescript-build-linker/package.json', '/home/eric/workspace/github/typescript-tools/packages/update-lerna-manifest/package.json', '/home/eric/workspace/github/typescript-tools/packages/use-hoisted-version/package.json' ] [11:50:12 AM] › 🎉 Started multirelease! Loading 24 packages... [11:50:12 AM] › ✔ Loaded package @typescript-tools/configure-lerna-manifest [11:50:12 AM] › ✔ Loaded package @typescript-tools/containing-packages [11:50:12 AM] › ✔ Loaded package @typescript-tools/dependency-graph [11:50:12 AM] › ✔ Loaded package @typescript-tools/depender-graph [11:50:12 AM] › ✔ Loaded package @typescript-tools/find-package [11:50:12 AM] › ✔ Loaded package @typescript-tools/hoisted-package-json [11:50:12 AM] › ✔ Loaded package @typescript-tools/hoisted-packages [11:50:12 AM] › ✔ Loaded package @typescript-tools/internal-dependencies [11:50:12 AM] › ✔ Loaded package @typescript-tools/internal-dependers [11:50:12 AM] › ✔ Loaded package @typescript-tools/io-ts [11:50:12 AM] › ✔ Loaded package @typescript-tools/lerna-packages [11:50:12 AM] › ✔ Loaded package @typescript-tools/lerna-utils [11:50:12 AM] › ✔ Loaded package @typescript-tools/link-dependency-executables [11:50:12 AM] › ✔ Loaded package @typescript-tools/link-local-dependencies [11:50:12 AM] › ✔ Loaded package @typescript-tools/monorepo-root [11:50:12 AM] › ✔ Loaded package @typescript-tools/package-manifests [11:50:12 AM] › ✔ Loaded package @typescript-tools/packages-to-rebuild-on-changes [11:50:12 AM] › ✔ Loaded package @typescript-tools/packages-to-rebuild-on-changes-cli [11:50:12 AM] › ✔ Loaded package @typescript-tools/pin-lerna-package-versions [11:50:12 AM] › ✔ Loaded package @typescript-tools/stringify-json [11:50:12 AM] › ✔ Loaded package @typescript-tools/tsconfig-includes [11:50:12 AM] › ✔ Loaded package @typescript-tools/typescript-build-linker [11:50:12 AM] › ✔ Loaded package @typescript-tools/update-lerna-manifest [11:50:12 AM] › ✔ Loaded package @typescript-tools/use-hoisted-version [11:50:12 AM] › 🎉 Queued 24 packages! Starting release... [11:50:12 AM] [@typescript-tools/configure-lerna-manifest] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/containing-packages] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/dependency-graph] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/depender-graph] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/find-package] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/hoisted-package-json] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/hoisted-packages] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/internal-dependencies] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/internal-dependers] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/io-ts] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/lerna-packages] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/lerna-utils] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/link-dependency-executables] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/link-local-dependencies] › ℹ Running semantic-release version 17.4.7 [11:50:12 AM] [@typescript-tools/monorepo-root] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/package-manifests] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/pin-lerna-package-versions] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/stringify-json] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/tsconfig-includes] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/typescript-build-linker] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/update-lerna-manifest] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/use-hoisted-version] › ℹ Running semantic-release version 17.4.7 [11:50:13 AM] [@typescript-tools/configure-lerna-manifest] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/configure-lerna-manifest] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/configure-lerna-manifest] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/configure-lerna-manifest] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/containing-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/containing-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/containing-packages] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/containing-packages] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/dependency-graph] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/dependency-graph] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/dependency-graph] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/dependency-graph] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/hoisted-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/hoisted-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/hoisted-packages] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/hoisted-packages] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/depender-graph] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/depender-graph] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/depender-graph] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/depender-graph] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/hoisted-package-json] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/hoisted-package-json] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/hoisted-package-json] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/hoisted-package-json] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/find-package] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/find-package] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/find-package] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/find-package] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/internal-dependencies] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/internal-dependencies] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/internal-dependencies] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/internal-dependencies] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/internal-dependers] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/internal-dependers] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/internal-dependers] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/internal-dependers] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/io-ts] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/io-ts] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/io-ts] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/io-ts] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/lerna-utils] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/lerna-utils] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/lerna-utils] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/lerna-utils] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/package-manifests] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/package-manifests] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/package-manifests] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/package-manifests] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/lerna-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/lerna-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/lerna-packages] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/lerna-packages] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/monorepo-root] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/monorepo-root] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/monorepo-root] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/monorepo-root] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/link-dependency-executables] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/link-dependency-executables] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/link-dependency-executables] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/link-dependency-executables] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/link-local-dependencies] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/link-local-dependencies] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/link-local-dependencies] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/link-local-dependencies] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/pin-lerna-package-versions] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/pin-lerna-package-versions] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/pin-lerna-package-versions] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/pin-lerna-package-versions] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/tsconfig-includes] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/tsconfig-includes] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/tsconfig-includes] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/tsconfig-includes] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/stringify-json] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/stringify-json] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/stringify-json] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/stringify-json] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/use-hoisted-version] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/use-hoisted-version] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/use-hoisted-version] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/use-hoisted-version] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/update-lerna-manifest] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/update-lerna-manifest] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/update-lerna-manifest] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/update-lerna-manifest] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/typescript-build-linker] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:50:13 AM] [@typescript-tools/typescript-build-linker] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/typescript-build-linker] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:50:13 AM] [@typescript-tools/typescript-build-linker] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:50:19 AM] [@typescript-tools/containing-packages] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:19 AM] [@typescript-tools/depender-graph] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:19 AM] [@typescript-tools/link-dependency-executables] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:20 AM] [@typescript-tools/hoisted-package-json] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:20 AM] [@typescript-tools/containing-packages] › ✔ Allowed to push to the Git repository [11:50:20 AM] [@typescript-tools/containing-packages] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:20 AM] [@typescript-tools/depender-graph] › ✔ Allowed to push to the Git repository [11:50:20 AM] [@typescript-tools/depender-graph] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:20 AM] [@typescript-tools/find-package] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:20 AM] [@typescript-tools/link-dependency-executables] › ✔ Allowed to push to the Git repository [11:50:20 AM] [@typescript-tools/link-dependency-executables] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:20 AM] [@typescript-tools/hoisted-package-json] › ✔ Allowed to push to the Git repository [11:50:20 AM] [@typescript-tools/hoisted-package-json] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:20 AM] [@typescript-tools/find-package] › ✔ Allowed to push to the Git repository [11:50:20 AM] [@typescript-tools/find-package] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:20 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:21 AM] [@typescript-tools/monorepo-root] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:21 AM] [@typescript-tools/configure-lerna-manifest] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:21 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ✔ Allowed to push to the Git repository [11:50:21 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:21 AM] [@typescript-tools/stringify-json] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:21 AM] [@typescript-tools/lerna-packages] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:21 AM] [@typescript-tools/internal-dependers] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:21 AM] [@typescript-tools/monorepo-root] › ✔ Allowed to push to the Git repository [11:50:21 AM] [@typescript-tools/monorepo-root] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:21 AM] [@typescript-tools/configure-lerna-manifest] › ✔ Allowed to push to the Git repository [11:50:21 AM] [@typescript-tools/configure-lerna-manifest] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:22 AM] [@typescript-tools/stringify-json] › ✔ Allowed to push to the Git repository [11:50:22 AM] [@typescript-tools/stringify-json] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:22 AM] [@typescript-tools/lerna-packages] › ✔ Allowed to push to the Git repository [11:50:22 AM] [@typescript-tools/lerna-packages] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:22 AM] [@typescript-tools/internal-dependers] › ✔ Allowed to push to the Git repository [11:50:22 AM] [@typescript-tools/internal-dependers] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:22 AM] [@typescript-tools/package-manifests] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:22 AM] [@typescript-tools/tsconfig-includes] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:22 AM] [@typescript-tools/link-local-dependencies] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:22 AM] [@typescript-tools/io-ts] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:23 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode hamroctopus hamroctopus [11:50:23 AM] [@typescript-tools/tsconfig-includes] › ✔ Allowed to push to the Git repository [11:50:23 AM] [@typescript-tools/tsconfig-includes] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:23 AM] [@typescript-tools/package-manifests] › ✔ Allowed to push to the Git repository [11:50:23 AM] [@typescript-tools/package-manifests] › ℹ Start step "verifyConditions" of plugin "Inline plugin" npm ERR! code ENEEDAUTH npm ERR! need auth This command requires you to be logged in. npm ERR! need auth You need to authorize this machine using `npm adduser` npm ERR! A complete log of this run can be found in: npm ERR! /home/eric/.npm/_logs/2021-10-23T16_50_23_189Z-debug.log [11:50:23 AM] [@typescript-tools/link-local-dependencies] › ✔ Allowed to push to the Git repository [11:50:23 AM] [@typescript-tools/link-local-dependencies] › ℹ Start step "verifyConditions" of plugin "Inline plugin" hamroctopus [11:50:23 AM] [@typescript-tools/hoisted-packages] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:23 AM] [@typescript-tools/io-ts] › ✔ Allowed to push to the Git repository [11:50:23 AM] [@typescript-tools/io-ts] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:23 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ✔ Allowed to push to the Git repository [11:50:23 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ℹ Start step "verifyConditions" of plugin "Inline plugin" hamroctopus [11:50:23 AM] [@typescript-tools/dependency-graph] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:24 AM] [@typescript-tools/hoisted-packages] › ✔ Allowed to push to the Git repository [11:50:24 AM] [@typescript-tools/hoisted-packages] › ℹ Start step "verifyConditions" of plugin "Inline plugin" hamroctopus [11:50:24 AM] [@typescript-tools/lerna-utils] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode hamroctopus hamroctopus [11:50:24 AM] [@typescript-tools/typescript-build-linker] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:24 AM] [@typescript-tools/use-hoisted-version] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode hamroctopus [11:50:24 AM] [@typescript-tools/dependency-graph] › ✔ Allowed to push to the Git repository [11:50:24 AM] [@typescript-tools/dependency-graph] › ℹ Start step "verifyConditions" of plugin "Inline plugin" hamroctopus hamroctopus [11:50:24 AM] [@typescript-tools/update-lerna-manifest] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:24 AM] [@typescript-tools/depender-graph] › ✔ Completed step "verifyConditions" of plugin "Inline plugin" [11:50:24 AM] [@typescript-tools/lerna-utils] › ✔ Allowed to push to the Git repository [11:50:24 AM] [@typescript-tools/lerna-utils] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:24 AM] [@typescript-tools/depender-graph] › ℹ Found git tag @typescript-tools/depender-graph@1.0.3 associated with version 1.0.3 on branch beta [11:50:24 AM] [@typescript-tools/depender-graph] › ℹ Found 118 commits since last release [11:50:24 AM] [@typescript-tools/depender-graph] › ℹ Start step "analyzeCommits" of plugin "Inline plugin" [11:50:24 AM] [@typescript-tools/typescript-build-linker] › ✔ Allowed to push to the Git repository [11:50:24 AM] [@typescript-tools/typescript-build-linker] › ℹ Start step "verifyConditions" of plugin "Inline plugin" npm ERR! code ENEEDAUTH npm ERR! need auth This command requires you to be logged in. npm ERR! need auth You need to authorize this machine using `npm adduser` npm ERR! A complete log of this run can be found in: npm ERR! /home/eric/.npm/_logs/2021-10-23T16_50_24_699Z-debug.log npm ERR! code ENEEDAUTH npm ERR! need auth This command requires you to be logged in. npm ERR! need auth You need to authorize this machine using `npm adduser` npm ERR! A complete log of this run can be found in: npm ERR! /home/eric/.npm/_logs/2021-10-23T16_50_24_726Z-debug.log [11:50:24 AM] [@typescript-tools/use-hoisted-version] › ✔ Allowed to push to the Git repository [11:50:24 AM] [@typescript-tools/use-hoisted-version] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:24 AM] [@typescript-tools/pin-lerna-package-versions] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:24 AM] [@typescript-tools/update-lerna-manifest] › ✔ Allowed to push to the Git repository [11:50:24 AM] [@typescript-tools/update-lerna-manifest] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [11:50:24 AM] [@typescript-tools/containing-packages] › ✔ Completed step "verifyConditions" of plugin "Inline plugin" [11:50:25 AM] [@typescript-tools/containing-packages] › ℹ Found git tag @typescript-tools/containing-packages@1.0.3 associated with version 1.0.3 on branch beta [11:50:25 AM] [@typescript-tools/containing-packages] › ℹ Found 65 commits since last release [11:50:25 AM] [@typescript-tools/containing-packages] › ℹ Start step "analyzeCommits" of plugin "Inline plugin" hamroctopus hamroctopus [11:50:25 AM] [@typescript-tools/internal-dependencies] › ⚠ Run automated release from branch beta on repository https://[secure]@github.com/typescript-tools/typescript-tools.git in dry-run mode [11:50:25 AM] [@typescript-tools/pin-lerna-package-versions] › ✔ Allowed to push to the Git repository [11:50:25 AM] [@typescript-tools/pin-lerna-package-versions] › ℹ Start step "verifyConditions" of plugin "Inline plugin" hamroctopus hamroctopus hamroctopus hamroctopus hamroctopus hamroctopus [11:50:25 AM] [@typescript-tools/internal-dependencies] › ✔ Allowed to push to the Git repository [11:50:25 AM] [@typescript-tools/internal-dependencies] › ℹ Start step "verifyConditions" of plugin "Inline plugin" hamroctopus hamroctopus [11:50:25 AM] [@typescript-tools/find-package] › ✖ Failed step "verifyConditions" of plugin "Inline plugin" [11:50:25 AM] [@typescript-tools/find-package] › ⚠ Skip step "fail" of plugin "@semantic-release/github" in dry-run mode [11:50:25 AM] [@typescript-tools/find-package] › ✖ EINVALIDNPMTOKEN Invalid npm token. The npm token (https://github.com/semantic-release/npm/blob/master/README.md#npm-registry-authentication) configured in the NPM_TOKEN environment variable must be a valid token (https://docs.npmjs.com/getting-started/working_with_tokens) allowing to publish to the registry https://registry.npmjs.org/. If you are using Two Factor Authentication for your account, set its level to "Authorization only" (https://docs.npmjs.com/getting-started/using-two-factor-authentication#levels-of-authentication) in your account settings. semantic-release cannot publish with the default " Authorization and writes" level. Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token. [multi-semantic-release]: AggregateError: SemanticReleaseError: Invalid npm token. at module.exports (/home/eric/workspace/github/typescript-tools/node_modules/@semantic-release/npm/lib/get-error.js:6:10) at module.exports (/home/eric/workspace/github/typescript-tools/node_modules/@semantic-release/npm/lib/verify-auth.js:26:33) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at async verifyConditions (/home/eric/workspace/github/typescript-tools/node_modules/@semantic-release/npm/index.js:36:7) at async validator (/home/eric/workspace/github/typescript-tools/node_modules/semantic-release/lib/plugins/normalize.js:34:24) at async /home/eric/workspace/github/typescript-tools/node_modules/semantic-release/lib/plugins/pipeline.js:37:34 at async Promise.all (index 0) at async next (/home/eric/workspace/github/typescript-tools/node_modules/p-reduce/index.js:16:18) at /home/eric/workspace/github/typescript-tools/node_modules/semantic-release/lib/plugins/pipeline.js:54:11 at async Object.pluginsConf. [as verifyConditions] (/home/eric/workspace/github/typescript-tools/node_modules/semantic-release/lib/plugins/index.js:80:11) at async run (/home/eric/workspace/github/typescript-tools/node_modules/semantic-release/index.js:95:3) at async module.exports (/home/eric/workspace/github/typescript-tools/node_modules/semantic-release/index.js:260:22) at async releasePackage (/home/eric/workspace/github/typescript-tools/node_modules/multi-semantic-release/lib/multiSemanticRelease.js:201:15) at async Promise.all (index 4) at async multiSemanticRelease (/home/eric/workspace/github/typescript-tools/node_modules/multi-semantic-release/lib/multiSemanticRelease.js:96:2) ```

What I find baffling is that the error I'm receiving is that my npm token is bad, but my npm username (hamroctopus) is being printed numerous times. I believe this comes from a call to some whoami endpoint but have not been able to verify this by reading through the code of semantic-release.

Even more astounding is when I remove --dry-run, the dry-run mode auto-engages (as I'm not a commonly-known CI environment) but a different code path must be triggered because I am prompted for my GitHub username:

NPM_TOKEN=foo GITHUB_TOKEN=bar npx multi-semantic-release
full output

``` multi-semantic-release version: 2.9.1 semantic-release version: 17.4.7 flags: { "sequentialInit": false, "firstParent": false, "debug": false, "deps": { "bump": "override", "release": "patch" }, "ignorePrivatePackages": false, "dryRun": false } package paths [ '/home/eric/workspace/github/typescript-tools/packages/configure-lerna-manifest/package.json', '/home/eric/workspace/github/typescript-tools/packages/containing-packages/package.json', '/home/eric/workspace/github/typescript-tools/packages/dependency-graph/package.json', '/home/eric/workspace/github/typescript-tools/packages/depender-graph/package.json', '/home/eric/workspace/github/typescript-tools/packages/find-package/package.json', '/home/eric/workspace/github/typescript-tools/packages/hoisted-package-json/package.json', '/home/eric/workspace/github/typescript-tools/packages/hoisted-packages/package.json', '/home/eric/workspace/github/typescript-tools/packages/internal-dependencies/package.json', '/home/eric/workspace/github/typescript-tools/packages/internal-dependers/package.json', '/home/eric/workspace/github/typescript-tools/packages/io-ts/package.json', '/home/eric/workspace/github/typescript-tools/packages/lerna-packages/package.json', '/home/eric/workspace/github/typescript-tools/packages/lerna-utils/package.json', '/home/eric/workspace/github/typescript-tools/packages/link-dependency-executables/package.json', '/home/eric/workspace/github/typescript-tools/packages/link-local-dependencies/package.json', '/home/eric/workspace/github/typescript-tools/packages/monorepo-root/package.json', '/home/eric/workspace/github/typescript-tools/packages/package-manifests/package.json', '/home/eric/workspace/github/typescript-tools/packages/packages-to-rebuild-on-changes/package.json', '/home/eric/workspace/github/typescript-tools/packages/packages-to-rebuild-on-changes-cli/package.json', '/home/eric/workspace/github/typescript-tools/packages/pin-lerna-package-versions/package.json', '/home/eric/workspace/github/typescript-tools/packages/stringify-json/package.json', '/home/eric/workspace/github/typescript-tools/packages/tsconfig-includes/package.json', '/home/eric/workspace/github/typescript-tools/packages/typescript-build-linker/package.json', '/home/eric/workspace/github/typescript-tools/packages/update-lerna-manifest/package.json', '/home/eric/workspace/github/typescript-tools/packages/use-hoisted-version/package.json' ] [11:51:39 AM] › 🎉 Started multirelease! Loading 24 packages... [11:51:39 AM] › ✔ Loaded package @typescript-tools/configure-lerna-manifest [11:51:39 AM] › ✔ Loaded package @typescript-tools/containing-packages [11:51:39 AM] › ✔ Loaded package @typescript-tools/dependency-graph [11:51:39 AM] › ✔ Loaded package @typescript-tools/depender-graph [11:51:39 AM] › ✔ Loaded package @typescript-tools/find-package [11:51:39 AM] › ✔ Loaded package @typescript-tools/hoisted-package-json [11:51:39 AM] › ✔ Loaded package @typescript-tools/hoisted-packages [11:51:39 AM] › ✔ Loaded package @typescript-tools/internal-dependencies [11:51:39 AM] › ✔ Loaded package @typescript-tools/internal-dependers [11:51:39 AM] › ✔ Loaded package @typescript-tools/io-ts [11:51:39 AM] › ✔ Loaded package @typescript-tools/lerna-packages [11:51:39 AM] › ✔ Loaded package @typescript-tools/lerna-utils [11:51:39 AM] › ✔ Loaded package @typescript-tools/link-dependency-executables [11:51:39 AM] › ✔ Loaded package @typescript-tools/link-local-dependencies [11:51:39 AM] › ✔ Loaded package @typescript-tools/monorepo-root [11:51:39 AM] › ✔ Loaded package @typescript-tools/package-manifests [11:51:39 AM] › ✔ Loaded package @typescript-tools/packages-to-rebuild-on-changes [11:51:39 AM] › ✔ Loaded package @typescript-tools/packages-to-rebuild-on-changes-cli [11:51:39 AM] › ✔ Loaded package @typescript-tools/pin-lerna-package-versions [11:51:39 AM] › ✔ Loaded package @typescript-tools/stringify-json [11:51:39 AM] › ✔ Loaded package @typescript-tools/tsconfig-includes [11:51:39 AM] › ✔ Loaded package @typescript-tools/typescript-build-linker [11:51:39 AM] › ✔ Loaded package @typescript-tools/update-lerna-manifest [11:51:39 AM] › ✔ Loaded package @typescript-tools/use-hoisted-version [11:51:39 AM] › 🎉 Queued 24 packages! Starting release... [11:51:39 AM] [@typescript-tools/configure-lerna-manifest] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/containing-packages] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/dependency-graph] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/depender-graph] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/find-package] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/hoisted-package-json] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/hoisted-packages] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/internal-dependencies] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/internal-dependers] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/io-ts] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/lerna-packages] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/lerna-utils] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/link-dependency-executables] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/link-local-dependencies] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/monorepo-root] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/package-manifests] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/pin-lerna-package-versions] › ℹ Running semantic-release version 17.4.7 [11:51:39 AM] [@typescript-tools/stringify-json] › ℹ Running semantic-release version 17.4.7 [11:51:40 AM] [@typescript-tools/tsconfig-includes] › ℹ Running semantic-release version 17.4.7 [11:51:40 AM] [@typescript-tools/typescript-build-linker] › ℹ Running semantic-release version 17.4.7 [11:51:40 AM] [@typescript-tools/update-lerna-manifest] › ℹ Running semantic-release version 17.4.7 [11:51:40 AM] [@typescript-tools/use-hoisted-version] › ℹ Running semantic-release version 17.4.7 [11:51:40 AM] [@typescript-tools/configure-lerna-manifest] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/configure-lerna-manifest] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/configure-lerna-manifest] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/configure-lerna-manifest] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/configure-lerna-manifest] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/find-package] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/find-package] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/find-package] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/find-package] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/find-package] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/dependency-graph] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/dependency-graph] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/dependency-graph] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/dependency-graph] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/dependency-graph] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/depender-graph] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/depender-graph] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/depender-graph] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/depender-graph] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/depender-graph] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/containing-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/containing-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/containing-packages] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/containing-packages] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/containing-packages] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/internal-dependencies] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/internal-dependencies] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/internal-dependencies] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/internal-dependencies] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/internal-dependencies] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/internal-dependers] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/internal-dependers] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/internal-dependers] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/internal-dependers] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/internal-dependers] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/hoisted-package-json] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/hoisted-package-json] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/hoisted-package-json] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/hoisted-package-json] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/hoisted-package-json] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/io-ts] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/io-ts] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/io-ts] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/io-ts] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/io-ts] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/lerna-utils] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/lerna-utils] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/lerna-utils] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/lerna-utils] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/lerna-utils] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/hoisted-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/hoisted-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/hoisted-packages] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/hoisted-packages] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/hoisted-packages] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/link-dependency-executables] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/link-dependency-executables] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/link-dependency-executables] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/link-dependency-executables] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/link-dependency-executables] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/lerna-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/lerna-packages] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/lerna-packages] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/lerna-packages] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/lerna-packages] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/link-local-dependencies] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/link-local-dependencies] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/link-local-dependencies] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/link-local-dependencies] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/link-local-dependencies] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/monorepo-root] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/monorepo-root] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/monorepo-root] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/monorepo-root] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/monorepo-root] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/package-manifests] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/package-manifests] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/package-manifests] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/package-manifests] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/package-manifests] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/packages-to-rebuild-on-changes-cli] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/stringify-json] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/stringify-json] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/stringify-json] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/stringify-json] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/stringify-json] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/typescript-build-linker] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/typescript-build-linker] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/typescript-build-linker] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/typescript-build-linker] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/typescript-build-linker] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/pin-lerna-package-versions] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/pin-lerna-package-versions] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/pin-lerna-package-versions] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/pin-lerna-package-versions] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/pin-lerna-package-versions] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/update-lerna-manifest] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/update-lerna-manifest] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/update-lerna-manifest] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/update-lerna-manifest] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/update-lerna-manifest] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/use-hoisted-version] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/use-hoisted-version] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/use-hoisted-version] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/use-hoisted-version] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/use-hoisted-version] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. [11:51:40 AM] [@typescript-tools/tsconfig-includes] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [11:51:40 AM] [@typescript-tools/tsconfig-includes] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/tsconfig-includes] › ✔ Loaded plugin "success" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/tsconfig-includes] › ✔ Loaded plugin "fail" from "@semantic-release/github" [11:51:40 AM] [@typescript-tools/tsconfig-includes] › ⚠ This run was not triggered in a known CI environment, running in dry-run mode. Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': Username for 'https://github.com': ^C ```

I have tried npm Publish and Automation type npm tokens, I can't recall from the hundreds of attempts if the error messages are different or identical, but neither has been successful.

The fact that I get ENEEDAUTH errors locally means none of my GitHub Actions configuration is the lone culprit... :thinking:

EricCrosson commented 2 years ago

I have enabled a ton of debug output with both the --debug flag and the DEBUG=msr:* env var, and I have determined that this line prints and then execution errors before this line can be printed

antongolub commented 2 years ago

It is important for us to find the source of the problem. I'll try to debug your case tomorrow.

EricCrosson commented 2 years ago

I am very grateful for your help

EricCrosson commented 2 years ago

Getting closer to a root cause -- it seems that the body of this try block fails some of the time: https://github.com/semantic-release/npm/blob/7338fc25de82058ea83b1e6e6669707036c2d96a/lib/verify-auth.js#L21

but not all of the time, as I am seeing my username print many times. I instrumented this .js file in my node_modules with some console.log statements:

module.exports = async (npmrc, pkg, context) => {
  const {
    cwd,
    env: {DEFAULT_NPM_REGISTRY = 'https://registry.npmjs.org/', ...env},
    stdout,
    stderr,
  } = context;
  const registry = getRegistry(pkg, context);
  console.log('>>> npmrc is', npmrc)

  await setNpmrcAuth(npmrc, registry, context);

  console.log('>>> Temporary npmrc is')
  try {
    console.log(fs.readFileSync(npmrc, 'utf-8'))
  } catch (error) {
    console.log('>>> unable to read file', error.message)
  }

  console.log('>>> normalizedUrl(registry)', normalizeUrl(registry))
  console.log('>>> normalizedUrl(DEFAULT_NPM_REGISTRY)', normalizeUrl(DEFAULT_NPM_REGISTRY))

  if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) {
    try {
      const whoamiResult = execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], {cwd, env});
      whoamiResult.stdout.pipe(stdout, {end: false});
      whoamiResult.stderr.pipe(stderr, {end: false});
      await whoamiResult;
    } catch (error) {
      console.log('>>> Error is', error.message)
      throw new AggregateError([getError('EINVALIDNPMTOKEN', {registry})]);
    }
  }
};

and I see

>>> Temporary npmrc is
//registry.npmjs.org/:_authToken=[secure]
>>> normalizedUrl(registry) https://registry.npmjs.org
>>> normalizedUrl(DEFAULT_NPM_REGISTRY) https://registry.npmjs.org
>>> Error is Command failed with exit code 1: npm whoami --userconfig /tmp/b1bf839eb249e78f9bbf4bd2059dca4d/.npmrc --registry https://registry.npmjs.org/
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
npm ERR! need auth You need to authorize this machine using `npm adduser`

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/eric/.npm/_logs/2021-10-23T21_30_59_683Z-debug.log
hamroctopus
hamroctopus

Interestingly, the try/catch seems necessary around the fs.readFileSync! I wonder if that's indicative of a race condition somewhere.

I should note that I am on @semantic-release/npm v 7.1.3.

I tried reproducing the npm whoami failure without semantic-release, thankfully(?) the temporary file is not cleaned up. I am able to run

$ npm whoami --registry https://registry.npmjs.org --scope=@typescript-tools
hamroctopus

and I thought it might be a rate limit thing so I ran it asynchronously 100 times in a for loop and all 100 succeeded. Still digging

EricCrosson commented 2 years ago

I wanted to make sure it was not the case that program execution was continuing on to a different npm command before failing with the error, so I added a bunch of logs and was able to rule that out. It seems to be the whoami that sometimes fails.

I found this potentially related ticket, fixed 4 days ago in @semantic-release/npm v 8.0.2 https://github.com/semantic-release/npm/pull/413

but the NPM_TOKEN used in the temporary npmrc file match the environment variable I'm using, so that seems unlikely

EricCrosson commented 2 years ago

I was able to deploy locally!

[6:56:59 PM] › 🎉  Released 5 of 24 packages, semantically!

I had to comment out these three lines in my local copy of @semantic-version/npm: https://github.com/semantic-release/npm/blob/master/index.js#L42-L44

As a result, I'm going to consider this a bug with @semantic-release/npm and open an issue there instead. I hope to update here when I have a successful resolution.

Again, thank you so much for your help @antongolub. You really went above and beyond to help me get a working setup.

antongolub commented 2 years ago

Nice to know, that you've found a workaround! Anyway, I've updated release-testing demo repo to show how msr may be used with gh-actions.

antongolub commented 2 years ago

The same case: https://ci.appveyor.com/project/QIWI/masker/build/job/0cidiqwo50ymrqxk

antongolub commented 2 years ago

@EricCrosson,

Yet another temporary workaround: https://github.com/semrel-extra/npm

EricCrosson commented 2 years ago

Beautiful!

patrickarlt commented 1 month ago

I was running into a similar issue but getting a EINVALIDNPMTOKEN error even after setting up a valid token and ensuring all the settings were correct in NPM.

[7:23:27 PM] [@esri/arcgis-rest-developer-credentials] › ✖  EINVALIDNPMTOKEN Invalid npm token.
The npm token (https://github.com/semantic-release/npm/blob/master/README.md#npm-registry-authentication) configured in the NPM_TOKEN environment variable must be a valid token (https://docs.npmjs.com/getting-started/working_with_tokens) allowing to publish to the registry [https://registry.npmjs.org/.](https://registry.npmjs.org/)

If you are using Two Factor Authentication for your account, set its level to "Authorization only" (https://docs.npmjs.com/getting-started/using-two-factor-authentication#levels-of-authentication) in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.

[multi-semantic-release]: AggregateError: 
    SemanticReleaseError: Invalid npm token.

But the code in https://github.com/dhoulb/multi-semantic-release/issues/82#issuecomment-950139007 solved it for me so I'm hoping the helps someone else eventually.

2024-06-01_09-37-17