- Notifications
You must be signed in to change notification settings - Fork 90
Description
I am trying to use semantic-release to build an library in a GitLab CI/CD pipeline and then to publish the built npm package into the GitLab package registry.
During the publish step I keep getting a 422 error - "Project must contain components. Ensure you are using the correct directory structure".
Here is the log:
[10:40:29 AM] [semantic-release] › ℹ Start step "publish" of plugin "@semantic-release/gitlab"
[10:40:30 AM] [semantic-release] [@semantic-release/gitlab] › ℹ Uploaded file: https://my-gitlab-instance/some-path/index.js
[10:40:30 AM] [semantic-release] [@semantic-release/gitlab] › ℹ Uploaded file: https://my-gitlab-instance/some-path/LICENSE
[10:40:30 AM] [semantic-release] [@semantic-release/gitlab] › ℹ Uploaded file: https://my-gitlab-instance/some-path/README.md
[10:40:31 AM] [semantic-release] [@semantic-release/gitlab] › ✘ An error occurred while making a request to the GitLab release API:
HTTPError: Response code 422 (Project must contain components. Ensure you are using the correct directory structure)
at Request. (file:///my-project-path/node_modules/got/dist/source/as-promise/index.js:92:42)
at Object.onceWrapper (node:events:622:26)
at Request.emit (node:events:519:35)
at Request._onResponseBase (file:///my-project-path/node_modules/got/dist/source/core/index.js:609:22)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Request._onResponse (file:///my-project-path/node_modules/got/dist/source/core/index.js:649:13)
I'm not clear what the required directory structure is when trying to publish a package. I have included the following files in the release:
- index.js
- LICENSE
- README.md
Perhaps these are wrongly named or there are other files that are needed? Or perhaps some folder structure is needed?
Here is my .releaserc.json file:
{
"branches": ["develop"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/gitlab",
{
"gitlabUrl": "https://my-gitlab-instance",
"assets": [
{ "path": "index.js", "label": "Module" },
{ "path": "README.md", "label": "Documentation" },
{ "path": "LICENSE", "label": "License" }
]
}
],
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": ["package.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
These are the relevant dependencies:
"devDependencies": {
"semantic-release": "24.2.0",
"@semantic-release/git": "10.0.1",
"@semantic-release/gitlab": "13.2.1",
"@semantic-release/npm": "12.0.1",
...
}