Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support gitlab milestones in config #237

Merged
merged 2 commits into from
May 31, 2021

Conversation

rjferguson21
Copy link
Contributor

Adds support to attach milestones to the created GitLab Release via the plugin configuration

See: https://docs.gitlab.com/ee/api/releases/#create-a-release

@nfriend
Copy link
Contributor

nfriend commented May 17, 2021

@rjferguson21 This is really exciting! Sorry for the slow response here. I won't have time to take a look today or tomorrow, but I will prioritize this on Wednesday.

@nfriend
Copy link
Contributor

nfriend commented May 19, 2021

but I will prioritize this on Wednesday.

So sorry - ran out of time today! But will get to this tomorrow or Friday!

Copy link
Contributor

@nfriend nfriend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjferguson21 Thanks for putting this together! 👏

A couple of thoughts for you:

  1. Let's update the README with this new configuration option so that people know it's available.
  2. I tested this out in a test project, and it works great! I'm curious how you plan on using this, though. Do you plan on hard-coding a specific milestone in your config? Or will you dynamically configure the milestones property in a *.js config? The reason I ask is that I'm having trouble thinking how I would automate this association. One pattern people use is to create a milestone with the same name as the release (for example, this is what GitLab itself does). But this would be difficult to do using this plugin, since the release version is managed by semantic-release 🤔 This isn't a reason not to add this ability, but I just want to make sure I understand what kinds of workflows this will enable.

@rjferguson21
Copy link
Contributor Author

Thanks for looking at this and the feedback @nfriend. I've added the milestones option to the README.

Your second question is valid, we're using a job like this:

release:
  image: node:lts-alpine3.13
  stage: release
  script:
    - apk add jq moreutils curl git
    - |
      export MILESTONE=$(curl --header "PRIVATE-TOKEN: $RELEASE_TOKEN" $GITLAB_URL/api/v4/groups/$GROUP_ID/milestones\?state\=active | jq .[-1].title)
    - jq ".plugins[4][1].milestones = [$MILESTONE]" .releaserc.json | sponge .releaserc.json
    - npm install -g semantic-release @semantic-release/git https://github.com/rjferguson21/gitlab#add-milestones @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/changelog
    - semantic-release
  only:
    - master

The idea is to associate project releases to a group level milestone, so this script block tries to go fetch the current active milestone and attaches the particular project's release to a group level milestone. It is a bit challenging because semantic-release does not support passing in arguments to plugins via the command line, so I am having to mutate the project's release config in CI (I chose the .json version).

@nfriend
Copy link
Contributor

nfriend commented May 21, 2021

@rjferguson21 Awesome, thanks for updating the documentation!

And thanks for the details about automating the associating to the active group level milestone.

This PR looks good to me 👍

@travi I noticed I now have permission to merge in this repo. Is there any particular process I should be following before merging? Or would you like me to continue pinging one of you for final review/merge?

@nfriend
Copy link
Contributor

nfriend commented May 27, 2021

cc @pvdlg @gr2m in case you can answer my question about the review process above 😄

@travi
Copy link
Member

travi commented May 27, 2021

@nfriend sorry for missing your question before. you are welcome to merge if you believe that contributions are ready for release. thank you for confirming, though.

ideally, the test suite should protect us from breakage. if we ever find that to be untrue, the goal would be to close the holes that we find. publishing a revert or a fix is an option in the cases where something slips through.

you also now have triage rights across all semantic-release repos. we appreciate the help you've been giving for this plugin. up to you if you want to participate in other areas.

@nfriend
Copy link
Contributor

nfriend commented May 31, 2021

Awesome, thanks @travi!

And thanks for this @rjferguson21, merging now 👍

@nfriend nfriend merged commit f2b61d7 into semantic-release:master May 31, 2021
@github-actions
Copy link

🎉 This PR is included in version 6.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants