git icon indicating copy to clipboard operation
git copied to clipboard

Unable to sign tags

Open jamime opened this issue 5 years ago • 1 comments

In my GitHub Actions, I use crazy-max/ghaction-import-gpg which internally runs

$ git config tag.gpgsign true

however when semantic release tries to create the tag I get the error

[1:28:33 PM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Command failed with exit code 1: git tag v17.2.1 2c8fbc034892f534dcf4915ff4a1aebd75874fdd
error: Terminal is dumb, but EDITOR unset
Please supply the message using either -m or -F option.
    at makeError (/home/runner/work/repo/repo/node_modules/execa/lib/error.js:58:11)
    at handlePromise (/home/runner/work/repo/repo/node_modules/execa/index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async tag (/home/runner/work/repo/repo/node_modules/semantic-release/lib/git.js:224:3)
    at async run (/home/runner/work/repo/repo/node_modules/semantic-release/index.js:190:5)
    at async module.exports (/home/runner/work/repo/repo/node_modules/semantic-release/index.js:259:22)
    at async module.exports (/home/runner/work/repo/repo/node_modules/semantic-release/cli.js:55:5) {
  shortMessage: 'Command failed with exit code 1: git tag v17.2.1 2c8fbc034892f534dcf4915ff4a1aebd75874fdd',
  command: 'git tag v17.2.1 2c8fbc034892f534dcf4915ff4a1aebd75874fdd',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'error: Terminal is dumb, but EDITOR unset\n' +
    'Please supply the message using either -m or -F option.',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Because the tag isn't created but the commit succeeds it triggers the job again, repeatedly until I cancel the job.

  "devDependencies": {
    "@semantic-release/changelog": "^5.0.1",
    "@semantic-release/git": "^9.0.0",
    "semantic-release": "^17.2.2"
  },

It would be great if we can support tag signing by passing a message.

jamime avatar Nov 13 '20 13:11 jamime

semantic-release itself, not this plugin, creates the tag:

    await tag(nextRelease.gitTag, nextRelease.gitHead, {cwd, env});

tag is defined here:

/**
 * Tag the commit head on the local repository.
 *
 * @param {String} tagName The name of the tag.
 * @param {String} ref The Git reference to tag.
 * @param {Object} [execaOpts] Options to pass to `execa`.
 *
 * @throws {Error} if the tag creation failed.
 */
async function tag(tagName, ref, execaOptions) {
  await execa('git', ['tag', tagName, ref], execaOptions);
}

As you can see, a lightweight tag is created, which does not support signing I believe.

Maybe open an issue in https://github.com/semantic-release/semantic-release?

cherryblossom000 avatar May 09 '21 02:05 cherryblossom000

See https://github.com/semantic-release/semantic-release/issues/3065.

sheerlox avatar Nov 22 '23 20:11 sheerlox