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

Add scripts to automate GitHub releases #6653

Merged
merged 4 commits into from
Jul 18, 2019

Conversation

whymarrh
Copy link
Contributor

@whymarrh whymarrh commented May 23, 2019

This PR updates our CircleCI configuration, adding new 1 new job and 1 new workflow to automate parts of our release process. The work here ultimately results in a GitHub Release with the artifacts from npm run dist attached.

The Workflow

The high-level workflow is:

  • A version branch is created off of develop
    1. CI sets the manifest version and commits that
    2. CI creates a Pull Request for the version
  • When the Pull Request gets merged, CI creates a tag and GitHub Release for the commit

I've been playing around with the configuration on my fork, if you want to look at the CI builds for that repository:

Step 1: Creating a RC Pull Request

End result: a pull request for the version is created

Process: when a branch is created matching ^Version-v\d+[.]\d+[.]\d+, a CI job will use the version number from the branch name to update the version field in the manifest, and create a PR for that change. That PR can then be reviewed and updated as appropriate. When we go to merge the PR, we can squash+merge the changes into a single commit with the message Version vX.Y.Z.

Step 2: Creating a GitHub Release

End result: a release is created with the Chrome and Firefox builds attached

Process: when a commit to develop is made with a message matching ^Version v\d+[.]\d+[.]\d+. the CI build for that commit will include tagging it as vX.Y.Z and creating a release with the Chrome and Firefox builds as assets.

Unanswered Questions

  • How do we want to deal with CHANGELOG.md? Scripts added to update the changelog
  • Who should we set as reviewers on the RC PR? @MetaMask/extension-release-team

Tasks

  • Set GITHUB_TOKEN and GITHUB_TOKEN_USER environment variables in CircleCI
  • Double-check copy

Refs

.circleci/config.yml Outdated Show resolved Hide resolved
danjm
danjm previously requested changes May 23, 2019
.circleci/scripts/release-create-gh-release Outdated Show resolved Hide resolved
@danjm
Copy link
Contributor

danjm commented May 23, 2019

It would be nice to have an npm command that automates "Step 1: Creating a RC Pull Request". Should that fall within the scope of this PR?

@whymarrh
Copy link
Contributor Author

It would be nice to have an npm command that automates "Step 1: Creating a RC Pull Request". Should that fall within the scope of this PR?

I don't think there's much there. We can literally create the branch on GitHub itself in a second.

@whymarrh whymarrh force-pushed the ci-github-releases branch 3 times, most recently from 1909f74 to 6c98fd1 Compare May 28, 2019 13:58
@whymarrh whymarrh force-pushed the ci-github-releases branch from 6c98fd1 to c9b9a35 Compare May 28, 2019 21:09
@whymarrh whymarrh marked this pull request as ready for review May 28, 2019 21:10
danfinlay
danfinlay previously approved these changes May 28, 2019
Copy link
Contributor

@danfinlay danfinlay left a comment

Choose a reason for hiding this comment

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

A couple small questions.

Overall, looks awesome, definitely a few flags & commands that are new to me here.

Looks like it does stop short of automating the publication to the stores, which makes sense for now, as that's the most security sensitive bit. Since this PR excludes the most security critical piece, it seems generally safe to try out and see how we like it!

.circleci/config.yml Show resolved Hide resolved
.circleci/scripts/release-create-gh-release Show resolved Hide resolved
@bdresser bdresser added this to the UI Sprint 15 [June 24] milestone Jun 24, 2019
@whymarrh whymarrh force-pushed the ci-github-releases branch 5 times, most recently from b9633fb to d35a759 Compare July 5, 2019 17:26
@whymarrh
Copy link
Contributor Author

whymarrh commented Jul 5, 2019

Task remaining on this PR:

  • Rebase this
  • Add reviewers to the created PR (@MetaMask/extension-release-team)
  • Add a commit with the updated changelog headers to the PR
  • Add the changelog contents to body of the GitHub release entry

@whymarrh whymarrh force-pushed the ci-github-releases branch from c21562a to 56ddde7 Compare July 5, 2019 18:40
@whymarrh
Copy link
Contributor Author

whymarrh commented Jul 5, 2019

  • Add a commit with the updated changelog headers to the PR
  • Add the changelog contents to body of the GitHub release entry

I've added d096ead and 56ddde7 to do exactly those things. I think the code here is ready for review and I'm going to give it a QA pass over on my fork. I'll update here when I've confirmed that this all works as I'd like it to.

@whymarrh whymarrh force-pushed the ci-github-releases branch from 56ddde7 to a6a8a9c Compare July 8, 2019 15:59
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

I believe release-bump-changelog-version needs to be made executable? All the scripts but that one are showing as +x for me

@whymarrh whymarrh force-pushed the ci-github-releases branch 3 times, most recently from 1051b8a to bb45a51 Compare July 10, 2019 14:30
@whymarrh
Copy link
Contributor Author

I'm giving this one more QA pass on my fork now, I'll leave a comment here when it's ready for review

@whymarrh
Copy link
Contributor Author

Cool, I'm happy with where this is. I think this is good for another review. As it stands, this successfully creates a GitHub Release with the changelog and assets attached. You can see an example of the process on my fork:

  1. The version pull request: Version v7.0.0 RC whymarrh/metamask-extension#22
  2. The commit in particular with the updated manifest and changelog: whymarrh@4933fcd
  3. The GitHub Release: Version 7.0.0

Note that the release contains all the lines in the changelog for the given version so we have the opportunity to add content both before and after the pull request is created.

Note as well that there is a slight but important difference between the name of the branches we currently use and the branches we'll need to use to trigger these scripts: there is a v prefix for the version number. Additionally, we should be using the Squash and merge option on the version pull request on GitHub to ensure that the commit message is formatted correctly.

cc @danfinlay @Gudahtt

@whymarrh whymarrh force-pushed the ci-github-releases branch from bb45a51 to fdc2a7e Compare July 10, 2019 15:13
@whymarrh
Copy link
Contributor Author

I've added fdc2a7e as well to set the reviewer on the PR

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM

@danfinlay
Copy link
Contributor

Could we add your description of this flow (documentation of how to use these scripts) to our docs folder?

I also notice the line item:

  • Set GITHUB_TOKEN and GITHUB_TOKEN_USER environment variables in CircleCI

Should these tokens be the @metamaskbot keys? I imagine it would be posting the PRs.

@whymarrh
Copy link
Contributor Author

I also notice the line item:

  • Set GITHUB_TOKEN and GITHUB_TOKEN_USER environment variables in CircleCI

Should these tokens be the @metamaskbot keys? I imagine it would be posting the PRs.

Yes, that'll be set once these are merged in, via the Circle CI config page.

Could we add your description of this flow (documentation of how to use these scripts) to our docs folder?

Sure can! I'll note here though that these scripts aren't run directly and are only for CI (they've got checks in place to make sure as well) so it'll be more documenting how to trigger these scripts.

@whymarrh
Copy link
Contributor Author

I'm going to create a separate PR with some updates to the docs

@whymarrh
Copy link
Contributor Author

Set GITHUB_TOKEN and GITHUB_TOKEN_USER environment variables in CircleCI

I've set these on CI:

@danfinlay danfinlay dismissed danjm’s stale review July 18, 2019 05:51

Concerns addressed

@danfinlay danfinlay merged commit 83c2440 into MetaMask:develop Jul 18, 2019
@whymarrh whymarrh deleted the ci-github-releases branch July 18, 2019 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create automated Github Releases deploy script
5 participants