Skip to content

Release command 🚀 #243

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

Merged
merged 1 commit into from
Jun 21, 2020
Merged

Conversation

jordisala1991
Copy link
Member

@jordisala1991 jordisala1991 commented Mar 17, 2017

Command to make releases easy.

ToDo

  • Compile changelog
  • List PR
  • get labels of all PR
  • Determine what is the next tag
  • Check if the base branch is okay to do a release: build is okay
  • Print labels with colors, mark the ones that are not supposed to be there
  • Check if changelog is present on all PR that need to have it
  • Cleanup code

Nice to have

  • Move some responsabilities out of the command
  • Add test

Subject

There are a lot of manual tasks that can be done automatically. Maybe we don't start with a full automatic release process, but this will be the first step.

  • Check if we can create a commit with the changelog modifications and create a tag and a release on the repository

Yes, we can:

https://developer.github.com/v3/repos/contents/#get-contents
https://developer.github.com/v3/repos/contents/#update-a-file
https://developer.github.com/v3/git/tags/#create-a-tag-object
https://developer.github.com/v3/repos/releases/#create-a-release

@jordisala1991
Copy link
Member Author

jordisala1991 commented Mar 17, 2017

I know the code is totally crap right now.

This is some example of output when executing this command against doctrine-orm-admin-bundle:

sonata-project/doctrine-orm-admin-bundle
========================================

Project
-------


 [OK] The StyleCI analysis has passed https://styleci.io/analyses/8m94YK



 [OK] Coverage remained the same at 30.687% https://coveralls.io/builds/10608185



 [OK] The Travis CI build passed https://travis-ci.org/sonata-project/SonataDoctrineORMAdminBundle/builds/211361523


Pull requests
-------------

[STABLE] added captions to TOC tree in docs [docs] [Changelog not found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/669

[STABLE] update one to many documentation [docs] [Changelog not found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/667

[PATCH] Fixed wrong translation in one_to_many template [patch] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/666

[STABLE] Small clanup [pedantic] [Changelog not found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/662

[STABLE] Allow simplethings/entity-audit-bundle ^1.0 [pedantic] [Changelog not found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/661

[PATCH] Fix check access to object in view [patch] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/660

[PATCH] Fixed duplicate translation of "Delete" in edit tab view [patch] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/658

[PATCH] Translation is broken in oneToMany edit form [patch] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/657

[PATCH] Fixed wrong entity link in list view [bug] [patch] [review required] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/654

[PATCH] Use the right array conversion for filter value [patch] [review required] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/653

[PATCH] Remove deprecated translation logic [patch] [review required] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/651

[PATCH] TYPE_IS_NOT_EQUAL doesn't consider NULL values [patch] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/650

[STABLE] TYPE_NOT_CONTAINS doesn't consider NULL values [review required] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/649

[STABLE] Fixed deprecated BaseBlockService usage (#641) [review required] [Changelog found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/648

[STABLE] Apply fixes from StyleCI [No labels] [Changelog not found]
https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/647

Release
-------


 [OK] Next release will be: 3.1.3


Changelog
---------

## [3.1.3](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/compare/3.1.2...3.1.3) - 2017-03-19
### Fixed
- Fixed wrong translation in delete checkbox in `edit_orm_one_to_many_inline_table.html.twig` [#666](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/666)
- Fixed duplicate translation of "Delete" in edit tab view [#658](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/658)
- Fixed broken translation in oneToMany table view [#657](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/657)
- Fixed wrong link generation when calling `DatagridMapper::addIdentifier` on mapped field [#654](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/654)
- Use the right array conversion for filter value [#653](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/653)
- Consider NULL values when using 'is not equal' advanced model filter [#650](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/650)
- Consider NULL values when using 'does not contain' advanced string filter [#649](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/649)
- deprecated usage of Sonata\BlockBundle\Block\BaseBlockService [#648](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/648)

### Security
- Fixed view - check specific item collection, not to the whole collection. [#660](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/660)

### Changed
- translation in twig templates uses the twig translation filter [#651](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/651)

Without colors

@jordisala1991
Copy link
Member Author

Disabled travis for now on this PR, I don't want to trigger a lot of builds when pushing commits

@sstok
Copy link

sstok commented Mar 18, 2017

https://github.com/park-manager/hubkit Feel free to reuse the Version class which automatically determines the next possible version, validates gaps, etc 😃

Just make sure to keep the @author Sebastiaan Stok <s.stok@rollerscapes.net> 😉

Edit. Hmm, maybe I can move these to there own library 🤔

@jordisala1991
Copy link
Member Author

jordisala1991 commented Mar 18, 2017

Hmm, that would be nice, but I know what the next version should be by looking at the labels of all PRs. Is there a way to do that with your class @sstok ?

I mean, given a current release and a minor, patch string or integer give me the next release

@jordisala1991
Copy link
Member Author

I have a question about github.

When you tag a new version, how do you mark it as the latest release?

The thing is, when executing this command, I check for the latest release, but looking at doctrine-orm-admin-bundle the latest release is not the latest :trollface: .

https://github.com/sonata-project/SonataDoctrineORMAdminBundle/releases

@jordisala1991
Copy link
Member Author

jordisala1991 commented Mar 18, 2017

We can use this:

https://developer.github.com/v3/repos/contents/#get-contents

To get the content of the changelog, then prepend the new changelog and use that other method:

https://developer.github.com/v3/repos/contents/#update-a-file

To update it and create a commit for the next release, then use this:

https://developer.github.com/v3/git/tags/#create-a-tag-object

To create the tag pointing to that commit sha, and finally use this:

https://developer.github.com/v3/repos/releases/#create-a-release

To create the release pointing to that tag. 🎉

WDYT @sonata-project/contributors, sounds nice, but also risky if something goes wrong

EDIT

With that method there is no GPG signature on the release/tag (https://developer.github.com/changes/2016-04-04-git-signing-api-preview/). Looking at how symfony does that, seems that they have a method that creates a PR and auto merges with the changes on changelog and version:

symfony/symfony#21966

Looking at that PR there is no signature verification, seems like its automated. But then if we look at the tag / release , it is verified, so maybe that step is manual at the moment.

https://github.com/symfony/symfony/releases/tag/v3.2.6

@jordisala1991 jordisala1991 changed the title Release command Release command 🚀 Mar 18, 2017
@sstok
Copy link

sstok commented Mar 19, 2017

I mean, given a current release and a minor, patch string or integer give me the next release

Yes, you can take a version say v1.2.4 and ask for an increase of any part, including alpha, beta, rc, etc. v1.2.4 + minor = v1.3.0

https://github.com/park-manager/hubkit/blob/master/src/Helper/Version.php#L177

But there is a minor catch if you want to jump from v1.2.4 to 2.0.0-ALPHA1, you need to create this version explicit as you can also have v1.3.0-ALPHA1.

And all versions must follow the semver scheme ([v]major.minor.patch[-mataver]), nightly builds are simple ignored.

I will move these classes to there own package today (or tomorrow 😉 ).
https://github.com/rollerworks/version

@jordisala1991
Copy link
Member Author

Thanks @sstok , will try to refactor the determineNextVersion method using your package. 👍

@jordisala1991 jordisala1991 force-pushed the feature/release branch 2 times, most recently from b8d4074 to 45ba8bd Compare March 19, 2017 15:59
@jordisala1991 jordisala1991 force-pushed the feature/release branch 2 times, most recently from 1d8c1f6 to 4b92065 Compare March 20, 2017 20:57
@jordisala1991 jordisala1991 force-pushed the feature/release branch 3 times, most recently from 326c26b to 104b73f Compare March 21, 2017 19:53
@jordisala1991
Copy link
Member Author

My proposal is to leave this PR with only a command to show what the current state of the branch and what will be the changelog of the new version, status of merged PRs, etc..

And create another PR after this one is merged to do the automatic Pull request with the new changelog (maybe with automerge) and show to the user what commands needs to execute to create the tag (maybe?)

WDYT @sonata-project/contributors

@OskarStark
Copy link
Member

I executed it for the translation-bundle and got this result:
screenshot 2017-03-22 10 16 57

totally fine, except one thing:
screenshot 2017-03-22 10 16 18

This is not IRRELEVANT, there is only the require review label. We should verify, that at least one of docs, pedantic, patch, minor is assigned, I would leave major out, because this tool should only help create minor and patch versions for now, right?

In case there is not one of these labels applied, we should point this out, that the user of this command can fix this PR

@OskarStark
Copy link
Member

And currently I cannot execute this command for ecommerce

@OskarStark
Copy link
Member

as we were generating this changelog from now on, should we add the authors like symfony does?

ping @sonata-project/contributors

@greg0ire
Copy link
Contributor

The authors would be a really really nice touch!

@jordisala1991
Copy link
Member Author

Give me the format of authors, and I will add it.

@jordisala1991
Copy link
Member Author

I already added The pull request associated with every line of the changelog. But agree that having the author is nice too

@OskarStark
Copy link
Member

IMO this PR was a big amount of work and @jordisala1991 did it great!

This PR was opened 3 Months ago and still no merge.
@soullivaneuh what is still todo?
@jordisala1991 are you willing to write tests or could we do this in a separate step.

It would be great to get a tool which provides as much as it can help to create a new release...

@jordisala1991
Copy link
Member Author

I can write some tests, but I will also like to know the current state of this PR first. (And IMO it can be done in another step, because this will delay a lot this PR, it won't be easy to test everything)

@OskarStark
Copy link
Member

We should merge this

Copy link
Member

@soullivaneuh soullivaneuh left a comment

Choose a reason for hiding this comment

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

Note: No request change but I will handle the rest manually later.

@jordisala1991
Copy link
Member Author

Soon this will be a year old, 🎉

@greg0ire
Copy link
Contributor

That's cute! tpope/vim-pathogen#142

@core23
Copy link
Member

core23 commented Jan 12, 2019

Any progress here?

@core23
Copy link
Member

core23 commented Feb 29, 2020

Can we finally merge this, if this is still an open topic...

@greg0ire
Copy link
Contributor

Note: No request change but I will handle the rest manually later.

Does somebody know what this means?

@jordisala1991
Copy link
Member Author

jordisala1991 commented Jun 21, 2020

No idea, does the PR is still useful?

I can continue the work if this will help the release process and have a chance to get merged

@greg0ire
Copy link
Contributor

I will try it for next release and see how it compares to the bash script I wrote, maybe we will end up with a mix of both :P

@jordisala1991 jordisala1991 dismissed stale reviews from core23 and OskarStark via dd66d16 June 21, 2020 17:14
This release command with help the release manager to generate
the needed changelog and check that every PR is well formed,
have the correct labels, and have the needed changelog associated.
@jordisala1991
Copy link
Member Author

jordisala1991 commented Jun 21, 2020

I rebased the PR, squashed all commits, and fixed some of the reviews you have made here.
I can't merge your PR @greg0ire it will need a rebase too. A lot of things changed here.

For the command... IMO we should go with a similar strategy than Symfony uses. They have several commands, but the most important ones are (seen in a Symfony meetup):

  1. Prepare the release: it compiles all the changelog and automatically creates a PR with it.
  2. Release: once that PR is merged they have another command that automatically creates the tag, creates the release and attach the changelog.

This PR is going for the first step, we still missing the automatic PR creation but it can be done later too. Once we are good for the first step, we can go for the second to automate the process of creating the tag and the release

wdyt @sonata-project/contributors ?

@greg0ire
Copy link
Contributor

I agree, let's not try to do everything at once.

@greg0ire greg0ire dismissed soullivaneuh’s stale review June 21, 2020 18:55

Sullivan will not review this again

@greg0ire greg0ire merged commit c162356 into sonata-project:master Jun 21, 2020
@greg0ire
Copy link
Contributor

Thanks @jordisala1991 !

@jordisala1991
Copy link
Member Author

Thank you :) I will start thinking of next steps

@jordisala1991 jordisala1991 deleted the feature/release branch May 19, 2022 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants