With the introduction of Trusted Publishers it is now important to use npm >= 11 to avoid errors. Setting up a simple GH action
jobs:
publish:
runs-on: ubuntu-latestname: Releasesteps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6with:
node-version: '24'
- run: npm -v
- run: npx semantic-releaseenv:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}And my release.config.js set like this:
exportdefault{// ....plugins: [// ...['@semantic-release/exec',{prepareCmd: 'npm -v'}]]}The logs will show two completely different npm versions 11.12.1 and 10.9.2. Attempting to explicitly set the shell with shell: '/bin/bash' or executing the command bash -c 'npm -v' does not solve the issue. My impression is that exec commands are running outside the execution environment set by the actions/setup-node@v6.
With the introduction of Trusted Publishers it is now important to use
npm >= 11to avoid errors. Setting up a simple GH actionAnd my
release.config.jsset like this:The logs will show two completely different npm versions
11.12.1and10.9.2. Attempting to explicitly set the shell withshell: '/bin/bash'or executing the commandbash -c 'npm -v'does not solve the issue. My impression is that exec commands are running outside the execution environment set by theactions/setup-node@v6.