go-semantic-release / semantic-release

📦🚀 semantic-release written in Go
https://go-semantic-release.xyz
MIT License
395 stars 43 forks source link

How to include exec hook #158

Closed mueller-tobias closed 1 year ago

mueller-tobias commented 1 year ago

I'm struggeling on how to include the exec hook. I'm using it on gitlab without the hook without any problems. But i can't get the exec hook to work.

As far is read the docu it should work out of the box, because semantic-release should download the plugin. The content of the .semrel.rc is based on the example on the hooks-exec repository

gitlab-ci.yml

release:
  stage: release
  image:
    name: registry.gitlab.com/go-semantic-release/semantic-release:2.24.1
    entrypoint:
    - ''
  script:
  - semantic-release --allow-no-changes --hooks exec
  rules:
  - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  variables:
    GITLAB_TOKEN: "$SEMANTIC_RELEASE_TOKEN"

.semrel.rc

{
  "plugins": {
    "hooks": {
      "names": [
        "exec"
      ],
      "options": {
        "exec_on_success": ".gitlab/upload-tf.sh {{.NewRelease.Version}}",
        "exec_on_no_release": "echo {{.Reason}}: {{.Message}}"
      }
    }
  }
}

Log Output

$ semantic-release --allow-no-changes --hooks exec
[go-semantic-release]: version: 2.24.1
[go-semantic-release]: ci-condition plugin: GitLab CI@1.7.0
[go-semantic-release]: provider plugin: GitLab@1.11.0
[go-semantic-release]: getting default branch...
[go-semantic-release]: found default branch: main
[go-semantic-release]: found current branch: main
[go-semantic-release]: found current sha: 34b939b80[31](https://git.adfinis.com/adfinis-de/terraform-modules/terraform-rancher-rke2cluster/-/jobs/300024#L31)2e2b716d1550d1e1d06229c040927
[go-semantic-release]: plugin not found: hooks-exec
[go-semantic-release]: stopping plugins...

It there anything i'm missing here?

mueller-tobias commented 1 year ago

Fixed. I've used an old docker image that didn't contain the current version