-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add automated release workflows and update releasing guide #269
Conversation
@gaeljw this should be considered a "first draft" for the workflow. I've set up all the repo settings - protected branch rules, and a What I'm not so sure about it the right maven goals to call. Similar to this PR I need your attention and feedback to help get that right. |
First, very cool to see this automated workflows appearing in Cucumber repos :) The thing is cucumber-scala is not built with Maven but with sbt as you can see in the previous One thing to note is that the
I suppose first option would be enough? For reference, here is an example of a GitHub automated workflow for releasing a personal project: https://github.com/gaeljw/typetrees/blob/main/.github/workflows/release.yml (ignore the gpg step which for some reason I don't actually remember was set a bit differently in cucumber-scala and uses a file From what I understand, we should build a GitHub action |
.github/workflows/release-mvn.yml
Outdated
java-version: "11" | ||
cache: "maven" | ||
|
||
- uses: cucumber/action-publish-mvn@v1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably not work, should we define a cucumber/action-publish-sbt
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it sounds like it. If you can help with that it would be great. I'll set up the repo next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, as soon as you have the repo I can work on it.
Not sure how to test without actually doing any release but we'll see 😅
I have few Renovate open PRs that can serve as an excuse for doing a patch release anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I have added the repo and made you an admin.
https://github.com/cucumber/action-publish-sbt
We need to limit the access to these github actions repos as they're a potential vector for supply-chain attacks, so we don't give write access to the general commiters team for these repos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my understanding, we're using sbt
instead of mvn
for build automation, but are we still publishing to sonatype in the end? I'm just trying to get my head around the pieces of the ecosystem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think it's valid to do a patch release just to test the automation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to limit the access to these github actions repos as they're a potential vector for supply-chain attacks, so we don't give write access to the general commiters team for these repos.
Also, assuming we set up CI on the main
branch to run a test publish, it could be possible to leak those secrets so again we need to lock down who can push to main
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I'll have a look in the coming days.
No issue with limiting access to the action repo, perfectly make sense.
Just for my understanding, we're using
sbt
instead ofmvn
for build automation, but are we still publishing to sonatype in the end? I'm just trying to get my head around the pieces of the ecosystem.
Absolutely. sbt is very similar to Maven in the sense that it works for the JVM ecosystem and publish to Sonatype. It's juste way more fitted for Scala projects.
For the record, the artifact on Maven central: https://mvnrepository.com/artifact/io.cucumber/cucumber-scala
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattwynne I have a doubt: is the project version supposed to be x.y.z-SNAPSHOT
before pushing to the branch release/x.y.z
? Or should the Action retrieve branch name and make a release with the version given in the branch name?
2nd option seems more natural to me but I don't see anything that does something similar in the Maven action or Maven project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question.
The "modern" process is outlined in https://github.com/cucumber/.github/blob/main/RELEASING.md and there are examples in, say https://github.com/cucumber/tag-expressions/tree/main/.github/workflows
Right now that process is to manually modify the CHANGELOG with the next release number, and manually update the relevant package descriptor, before pushing the commit to a release/*
branch. So the existing maven action just releases whatever it sees in pom.xml
.
In fact using the version number in the release branch is just a convention, you could call it release/foo
and it would still work. Nothing looks at the branch name currently.
The https://github.com/cucumber/action-create-github-release action does read the version number from the CHANGELOG, and potentially we could do the same to get the number needed for the sbt
release. In fact we have a special GitHub action for that: https://github.com/cucumber/action-get-versions which I was tinkering with for automating more of this, but I hadn't got around to it yet.
I added a commit to use the just-released cuucmber sbt action v1.0.0 and also updated the documentation. I will merge this PR as well as pending PR opened by Renovate to test the process and release a patch version of the library. |
@mattwynne after some small bugfixes it worked 🎊 Few comments:
|
Hey @gaeljw! (sorry for the hiatus, I've been ill but I seem to be recovering now) That's great you got it working!
Yes. @aurelien-reeves and I went back and forth on this. We settled on having separate workflows because GitHub, at the time, did not allow you to re-run individual failed jobs, only workflows. I believe they've just fixed that, so a single workflow probably makes more sense now.
Yes, my view is it's probably a good idea just to do a new patch release if something goes wrong with the release infrastructure. If that happens it will be easier to tell what's happened retrospectively, especially if it takes a few goes to fix something.
@mpkorstanje and I paired yesterday on the release automation for I don't think there's any harm in running something which tags the commit - the GitHub release action will re-tag the same commit but that's no problem IMO. So we could look at this as a later optimisation. We're also looking at automatically updating the changlog. The process is evolving all the time, and there's definitely more stuff we can streamline. I think cucumber-parent's
I think you can safely delete these branches once the release has completed. Maybe we can even automate that. |
Hope you're doing better @mattwynne 🙂 It seems I actually don't have rights on the protected branches. I can push to them but cannot delete them 🤔 I'll give a look to the work done on Thanks |
It's in the branch protection options somewhere. Deleting is not enabled by default but can be for anyone with push access. |
Been doing manual clean up while setting up. For intermittent failures this is nothing more then deleting a release branch and pushing the tag to it again. For more structural problems rolling back a few commits is also relatively easy. Delete the tag, Delete the release branch, reset main to the commit before release. |
I don't know about "vision" @mattwynne :) and one click probably isn't realistic given our constraints but I think "can do with a few operations on github.com" is a good north star. Running a workflow on main and then creating a release branch would definitely fit that bill. |
The thing I've been struggling with this idea is that, as far as I know, it's not possible to trigger a workflow to run as you (even if you use a |
Try again @gaeljw? |
@mattwynne yeah I more meant like:
Screen.Recording.2022-03-23.at.07.59.53.mov |
Better, thanks @mattwynne |
I do like the idea of running part of the release workflow on |
🤔 What's changed?
⚡️ What's your motivation?
Automate releases! 🎉 No more need to use the big docker image! 🎉
🏷️ What kind of change is this?
📋 Checklist: