Releasinator
Problem
When automating an SDK release process, many teams and languages have different ideas. The release process is a hurdle that makes it hard for new project members to ramp up. One shouldn't have to read a release_process.md to release an open source SDK.
Solution
The releasinator corrects this by enforcing standard must-have release files, being configurable where necessary, and reducing the ramp-up hurdle.
Making it work
Install
- Clone this repo
- Run
bundle installfrom terminal. It should download dependencies.
Setup
- Set the environment variable
GITHUB_TOKENwith a generated personal access token withreposcope.
Usage
cdto directory of the repo you'd like to release- Run
rake -t -f <path to releasinator>/Rakefile
Conventions
The releasinator enforces certain conventions. If a filename doesn't exactly match the convention, it is renamed to match, and automatically committed. The conventions are documented below:
README.mdLICENSE: See here for a relevant StackOverflow post on this discussion. This project has chosen to exclude the.txtextension to match other popular projects, and GitHub defaults.CONTRIBUTING.md: See a relevant GitHub blog post for relevant information. This project has chosen to include the.mdextension, as these files can get a bit unwieldy without formatting.CHANGELOG.md- This file is the source of truth for the releasinator. The file should be organized with the most recent release on top, and formatted correctly. The latest release is the one used when the releasinator executes, so it is a precondition that theCHANGELOG.mdhas been edited and committed prior to releasing.- Releases either are contained within an Alt-H2 (
------) or##H2format. Any other format will be rejected. - Each release MUST start with the release version, and may contain any following text, such as the date, and/or any release summary.
- Releases either are contained within an Alt-H2 (
Behind the Scenes
Validations
- ✓ Validate git version.
- ✓ Validate git's cleanliness (no untracked, unstaged, or uncommitted files).
- ✓ Validate current git branch is up to date with the latest version on server.
- ✓ Validate current git branch is
master(if no git flow), ordeveloporrelease/<Release number>if using git flow. - ✓ Validate the presence of
.gitignore, adding it if needed, and adding any needed lines. - ✓ Validate the presence of the
README.mdfile. - ✓ Validate the presence of the
CHANGELOG.mdfile. - ✓ Validate the
CHANGELOG.mdfile is properly formatted. - ✓ Validate semver release number sequence in
CHANGELOG.md. (Note: cannot detect duplicate versions, due to the underlying Hash implementation of the parsing library.) - ✓ Validate the presence of
LICENSE. - ✓ Validate the presence of
CONTRIBUTING.md. - ✓ Validate the presence of
.github/ISSUE_TEMPLATE.md. - ✓ Validate
LICENSEandCONTRIBUTING.mdare referenced inREADME.md. - ✓ Validate all submodules are up to date with the latest master version.
- ✓ Validate all files are committed to git (
git ls-files --others --exclude-standard). - ✓ Validate user has valid access_tokens as environment variables for all repos (public & enterprise). Public github requires
GITHUB_TOKEN, while enterprise tokens add a modified version of their domain as a prefix. For example, github.example.com requiresGITHUB_EXAMPLE_COM_GITHUB_TOKEN. - ✓ Validate user has permissions to push to repo, and downstream repos.
- ✓ Validate anything as defined by the configuration. Examples:
- Compiling with the right version of the platform.
- Upstream library dependencies are the latest available.
Package manager credential management
- Validate permissions to publish to package manager
- If permissions are needed, retrieve them from the secret credential repo, and run any subsequent repo steps.
Performs internal-only tasks:
- ✓ Confirm user has completed all manual tasks (aka pre-release checklist).
- ✓ Confirm overwrite of local tags already matching version.
- ✓ Create local tag.
- ✓ Run build command, as specified in the config file.
Performs external-facing tasks:
- ✓ Clone/reset any downstream external distribution repos.
- ✓ Copy to destination repo:
* `README.md`
* `CHANGELOG.md`
* `LICENSE`
* `CONTRIBUTING.md`
* `.github/ISSUE_TEMPLATE.md`
* Any other distribution files. This will be configured.
- ✓ Modify any dependency/versions in
README.md, source, or sample apps to the latest version. The location and regex of these will be configured. ✓ Build code and/or Sample apps.
- TODO If build fails, pause build and give developer a chance to fix the downstream build and retry without completely starting over.
✓ Push to appropriate package manager (nexus/cocoapods/composer/npm/nuget/rubygem/pypi).
✓ Confirm overwrite of remote tags already matching version.
✓ Create root and downstream repo tag and GitHub release. The name of the release is the tag, and the annotated description and GitHub release is the relevant section of the
CHANGELOG.md.✓ Create downstream GitHub branch.
✓ Correctly handle git flow branches and merging.
✓ Push to external repo (once live in external package manager).
✓ Create PRs into any downstream dependencies, including the release notes in the PR. Examples:
* Create a PR into Braintree when mSDK/OTC release.
* Create a PR into Cordova when mSDK release.
* Create a PR into any other framework that has a direct dependency on this repo.
- TODO add those same release notes within the release notes of the downstream repo.
- Assemble a draft of news, and publish (where possible, i.e. send email, tweet, whatever).
Open items:
- Might need a different name - releasinator is taken