Skip to content

pkgRoot property not working #601

@paulorenanmelo

Description

@paulorenanmelo

Hi, I'm having an error using Semantic Release, which seems to indicate that the pkgRoot variable is not being picked up:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /builds/squint-nyc/bootstrap-in-a-snap/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/builds/squint-nyc/bootstrap-in-a-snap/package.json'
npm ERR! enoent This is related to npm not being able to find a file.

My folder structure (relative to /builds/squint-nyc/bootstrap-in-a-snap/) is as follows:

.releaserc.json
.gitlab-ci.yml
Packages/com.squintopera.unity.bootstrap/package.json

And here is my releaserc.json. Am I doing something wrong, or is it a bug in SemanticRelease?

{
  "branch": "master",
  "tagFormat": "v${version}",
  "plugins": [
    ["@semantic-release/commit-analyzer", { 
      "preset": "angular" 
    }],
    "@semantic-release/release-notes-generator",
    ["@semantic-release/npm", { 
      "npmPublish": true,
      "pkgRoot": "./Packages/com.squintopera.unity.bootstrap"
    }],
    ["@semantic-release/changelog", { 
      "preset": "angular",
      "changelogFile": "CHANGELOG.md"
    }],
    ["@semantic-release/git", {
      "assets": [
        "package.json",
        "README.md",
        "CHANGELOG.md",
        "Packages/com.squintopera.unity.bootstrap/**/*.*"
      ],
      "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
    }],
    "@semantic-release/gitlab"
  ]
}

And here is my gitlab-ci.yml

image: node:18.7.0-buster-slim

stages:
  - release

variables:
  GIT_STRATEGY: fetch
  GIT_SUBMODULE_STRATEGY: recursive
  GIT_DEPTH: "0"
  GITLAB_TOKEN: $CI_API_TOKEN
  PKG_ROOT: Packages/com.squintopera.unity.bootstrap
  
package:
  stage: release
  only:
    - master
  before_script:
    - apt-get update && apt-get install -y --no-install-recommends git-core git-lfs ca-certificates
    - npm install -g semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/gitlab
  script:
    - git lfs pull
    - | # Rename Samples to Samples~ for packaging
      if [[ -d "$PKG_ROOT/Samples" ]]; then
        mv $PKG_ROOT/Samples $PKG_ROOT/Samples~
        rm -f $PKG_ROOT/Samples.meta
      fi
    - | # Run semantic-release to generate changelog, bump version number, and push package
      npm config set com.squintopera.unity:registry ${NPM_REGISTRY_URL}
      npm config set '${NPM_REGISTRY_AUTH}' "${NPM_REGISTRY_TOKEN}"
      export NPM_TOKEN=${NPM_REGISTRY_TOKEN}
      npm run semantic-release

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions