Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.