semantic-release-action icon indicating copy to clipboard operation
semantic-release-action copied to clipboard

Installing extra plugin

Open johngeorgewright opened this issue 4 years ago • 8 comments

If I were to use an extra plugin that this action doesn't use, by default, it does not install it. Is this expected? Feels like this action could install all plugins defined.

johngeorgewright avatar Mar 22 '21 09:03 johngeorgewright

Can you explain the expected input and result? You want to list 1 or more non-standard plugins that you're using in your config and have the action install those for you right?

can you share what you've been trying so far to see what you'd expect to work? Maybe share a link or some code snippets?

codfish avatar Mar 22 '21 14:03 codfish

non-standard plugins

I was wondering the same, would it be possible to automatically install even only the official plugins which aren't bundled in semantic-release, this would save having to include them in a projects devDependencies.

MrSwitch avatar Mar 27 '21 07:03 MrSwitch

@johngeorgewright @MrSwitch hey guys, would you mind testing this before I merge? I don't have a real use case leveraging additional plugins. https://github.com/codfish/semantic-release-action/pull/170

To summarize: I've added an additional_packages input that will install any npm packages you specify, allowing you to use them in plugins or extends. Here's an example using semantic's apm extension & plugins:

- name: semantic-release
  uses: codfish/semantic-release-action@additional-packages
  with:
    extends: '@semantic-release/apm-config'
    additional_packages: |
      ['@semantic-release/[email protected]', '@semantic-release/git', '@semantic-release/apm-config']
    plugins: |
      ['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/github', '@semantic-release/apm', '@semantic-release/git']

If you have a config in your repo, that will work too, without needing to specify plugins or extends configuration through inputs.

Be sure to point to this branch when testing: uses: codfish/semantic-release-action@additional-packages.

codfish avatar Apr 03 '21 19:04 codfish

As per comments on #170

It's too easy for things to break by installing the plugins when there is no where to define a version.

I'll be using a npm install --no-save ... step in my implementation of this Github Action. The step would install the semantic-release dependencies which i dont want included in package.json.

Thanks @codfish 🙏

MrSwitch avatar Apr 04 '21 21:04 MrSwitch

@MrSwitch much appreciated! I'll leave the issue open for a little bit to see if we have any change of heart or other perspectives

codfish avatar Apr 06 '21 16:04 codfish

@codfish do you think this could be merged into main?

joaofnds avatar Mar 01 '22 11:03 joaofnds

@joaofnds yea, I think it can. Going to look it over to refresh my memory and update it if need be

what @MrSwitch said can be done as well (running npm install in a separate step before semantic), but this PR just essentially runs npm install --no-save [additional_plugins...] for you as a convenience so everything can be done in the same step.

specific versions can be specified directly in the package names provided, i.e.

additional_packages: |
    ['@semantic-release/[email protected]', '@semantic-release/git', '@semantic-release/apm-config']

codfish avatar Mar 07 '22 00:03 codfish

@codfish I'm using this. but I'm getting the following error here.

Any idea about this? bit stuck here..

[2:05:47 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[2:05:47 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: docs(readme) : add gitpod option to readme (#108)
[2:05:47 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[2:05:47 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 7 commits complete: minor release
[2:05:47 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[2:05:47 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/exec"
[2:05:47 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/exec"
[2:05:47 PM] [semantic-release] › ℹ  The next release version is 0.4.0
[2:05:47 PM] [semantic-release] › ℹ  Start step "verifyRelease" of plugin "@semantic-release/exec"
[2:05:47 PM] [semantic-release] › ✔  Completed step "verifyRelease" of plugin "@semantic-release/exec"
[2:05:47 PM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[2:05:47 PM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[2:05:47 PM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/exec"
[2:05:47 PM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/exec"
[2:05:47 PM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/exec"
[2:05:47 PM] [semantic-release] [@semantic-release/exec] › ℹ  Call script set-version 0.4.0
/bin/sh: 1: set-version: not found
[2:05:47 PM] [semantic-release] › ✖  Failed step "prepare" of plugin "@semantic-release/exec"
[2:05:47 PM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Command failed with exit code [127](https://github.com/keploy/keploy/runs/6079249506?check_suite_focus=true#step:9:127): set-version 0.4.0
/bin/sh: 1: set-version: not found
    at makeError (/github/workspace/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/github/workspace/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async module.exports (/github/workspace/node_modules/@semantic-release/exec/lib/exec.js:16:11)
    at async prepare (/github/workspace/node_modules/@semantic-release/exec/index.js:54:5)
    at async validator (/action/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /action/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async /action/node_modules/semantic-release/lib/plugins/pipeline.js:31:3
    at async Object.pluginsConf.<computed> [as prepare] (/action/node_modules/semantic-release/lib/plugins/index.js:80:11)
    at async run (/action/node_modules/semantic-release/index.js:185:3) {
  shortMessage: 'Command failed with exit code 127: set-version 0.4.0',
  command: 'set-version 0.4.0',
  escapedCommand: '"set-version 0.4.0"',
  exitCode: 127,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: '/bin/sh: 1: set-version: not found',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  pluginName: '@semantic-release/exec'
}
Error: Error: Command failed with exit code 127: set-version 0.4.0
/bin/sh: 1: set-version: not found

slayerjain avatar Apr 19 '22 15:04 slayerjain

@slayerjain i know it's been awhile but any chance you remember what you had for your semantic release configuration when you got this error? just specifying it as an additional plugin wouldn't be enough.

https://github.com/semantic-release/exec#usage

what did you have as your config out of curiosity?

codfish avatar Aug 07 '22 16:08 codfish

:tada: This issue has been resolved in version 1.10.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Aug 07 '22 19:08 github-actions[bot]