Closed
Description
Hello! Not sure how I arrived at this particular error. I believe these are the salient parts of my workflow file:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: ${{ env.NPM_REGISTRY_URL }}
- name: Build
run: |
npm install
npm run build
- name: Test
run: |
npm test
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
registry: ${{ env.NPM_REGISTRY_URL }}
tag: "v${{ steps.version.outputs.value }}-${{ env.BETA_SUFFIX }}"
dry-run: true
Can you spot what I may be missing?
Metadata
Metadata
Assignees
Labels
No labels
Activity
michaelnlindsay commentedon Oct 24, 2023
NB: I do have a package.json file in the root directory that has 'version' field, returned by
steps.version.outputs.value
mcous commentedon Oct 24, 2023
What is the value of the
version
field in your package.json? This error could occur if the value is not valid semver.Also, that usage of the
tag
input looks suspicious. The meaning is npm's dist-tag, not the package versionAlso also, is that publish step running inside a matrix? If so, that's a bad idea! Might just be a copy paste issue
mcous commentedon Oct 24, 2023
@michaelnlindsay it looks like this is your
package.json
version:2.11.2a
is not a valid semantic version, and all packages published to npm must follow semver. I have opened #161 to improve the error message to something more helpful:fix(errors): improve message when version validation fails (#161)
michaelnlindsay commentedon Oct 24, 2023
Brilliant! Managed to land myself on the new error message too. Looks good, I understand what it's complaining about especially with inclusion of the version I supplied. It worked like a charm after I stopped trying to provide
tag
, any value give for that, even proper semvar, was throwing errors. Which is probably fine? Shouldn't need it anyway? Thanks for the swift response! Much appreciated :)mcous commentedon Oct 24, 2023
As mentioned above,
tag
should not be a version. The default value oftag
islatest
, as in:The purpose of
tag
is to create "release channels" of a sort. For example, you may publish canary versions that shouldn't be installed by default, but you could use:To publish versions that can be installed via:
michaelnlindsay commentedon Oct 24, 2023
Got it... I was obviously experimenting off the range, sorry about that. tag will be useful to me there then :D and
canary
is an excellent suggestion.