Skip to content

Version check fails if latest tag does not exist in registry #89

Closed
@hardillb

Description

@hardillb

I'm getting an error with v2 when trying to publish a tagged build to a GH npm repo

      - name: "publish foo"
        uses: JS-DevTools/npm-publish@v2.0.0
        with:
          tag: 'nightly'
          package: ./foo/package.json
          registry: https://npm.pkg.github.com
          token: ${{ secrets.GITHUB_TOKEN }}

Is giving the following error:

##[debug]Evaluating condition for step: 'publish foo'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: publish forge-ui-components
##[debug]Loading inputs
##[debug]Evaluating: secrets.GITHUB_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'GITHUB_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run JS-DevTools/npm-publish@v2.0.0
  with:
    tag: nightly
    package: ./foo/package.json
    registry: https://npm.pkg.github.com/
    token: ***
::add-mask::***
##[debug]Temporary .npmrc created at /home/runner/work/_temp/npm-publish-vT2pRJ/.npmrc
##[debug]; created by jsdevtools/npm-publish
##[debug]//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
##[debug]registry=https://npm.pkg.github.com/
##[debug]
##[debug]Running command: npm view --ignore-scripts --json @flowforge/forge-ui-components dist-tags versions
Error: TypeError: Cannot read properties of undefined (reading 'nightly')
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: publish forge-ui-components

If I setup my an equivalent .npmrc file locally and run

npm view --ignore-scripts --json @foo/foo dist-tags versions

it returns an empty string implying that the GH npm repo doesn't support the npm view command

I'm guessing this is to do with it trying to check the version for stagegy changes in v2.

Is there anyway to stop it doing this check? The release notes imply not and to use npm directly (but that means having to do all the .npmrc setup manually which is why I was using the action in the first place.

I'm going to roll back to v1 for now, but that is not a long term solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions