Ask Your Question
4

How can I obtain the name of the repository in the sharable configuration for semantic-release?

asked 2023-07-17 17:14:41 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-07-17 17:18:02 +0000

lalupa gravatar image

You can obtain the name of the repository in the sharable configuration for semantic-release by using the pkg.name property in the package.json file of your project. Here is an example:

// sharable configuration for semantic-release
module.exports = {
  branch: 'main',
  plugins: [
    [
      '@semantic-release/github',
      {
        assets: [
          { path: 'dist/**', label: 'Distribution Files' },
          { path: 'docs/**', label: 'Documentation' },
        ],
        successComment: false,
      },
    ],
    [
      '@semantic-release/npm',
      {
        npmPublish: false,
      },
    ],
  ],
  tagFormat: '${version}',
  verifyConditions: [],
  prepare: [],
};

In this configuration, you can access the name of the repository by using the ${pkg.name} variable in the tagFormat property. This will automatically replace the variable with the name of the repository defined in the package.json file.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-17 17:14:41 +0000

Seen: 15 times

Last updated: Jul 17 '23