diff --git a/DEPLOYING.md b/DEPLOYING.md deleted file mode 100644 index 34b796912..000000000 --- a/DEPLOYING.md +++ /dev/null @@ -1,40 +0,0 @@ -# Deploying Mapbox.js - -You need `aws` - - pip install awscli - -Then make the release with `make` - -* Write a `CHANGELOG.md` entry that describes your changes and links to - issues in question - -* Bump `package.json` version - -# rebuild - -Mapbox.js uses a version number pulled from `package.json`, so _after_ updating package.json, -rebuild it. - - make - -# git tag & npm package - - git tag v1.your.version -s -m "Version v1.your.version, with xxx changes" - git push origin mb-pages --tags - npm publish - -# deploying to the cdn - - ./deploy.sh v1.your.version - -# deploying to the web - -```sh -$ ./_docs/build.sh v1.your.version -``` - -Then `git add` the new generated files in the docs directory. - -Then update the version number in `_config.yml` and its variants, -and then in the relevant server software. diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 000000000..7b5e977c1 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,66 @@ +# Creating a release of mapbox.js + +The majority of the release process is done on a release branch. Once all the artifacts are built and published, you will need to get your release reviewed and approved. Once approved the release branch is ready to be merged into the default `publisher-production` branch. After being merged the release can be tagged and Github release created. + +Checklist: +- [ ] Make sure the changelog has been updated +- [ ] Do the release (part 1) in a release branch (using manual or automated process below) +- [ ] Create release PR and get it reviewed and approved +- [ ] Merge release branch into `publisher-production` +- [ ] Finalize the release (part 2) + +> Replace any instance of with your version + +## Part 1: +- This part of the release is done on a release branch +- This part of the relase will: + - version bump + - cdn publish + - npm publish + - generate docs pages + +### Option A: Automated release + +```terminal +$ npm run release +``` + +### Option B: Manual release + +```terminal +# Bump version +$ npm version --no-git-tag-version +$ git add package*.json +$ git commit -m "Update package*.json: " + +# Publish to NPM +$ npm login +$ npm publish + +# Publish to Mapbox CDN +$ ./deploy.sh v + +# Generate docs pages +$ ./deploy.sh v + +# Update mapboxjs version in `_config.yaml`, `_config.publisher-production.yml`, `_config.publisher-staging.yml` +$ find . -name '_config*.yml' -exec sed -i '' "s/^\\(\\s*mapboxjs\\s*:\\s*\\).*/\\1 /" {} \; + +# Commit configs and docs. +$ git add _config*.yml docs/* +$ git commit -m "Update docs/*: " +``` + +## Part 2: +- This part of the release is done on the publisher-production +- This part of the release will: + - git tag + - create Github release + +```terminal +$ git checkout publisher-production +$ git pull origin publisher-production +$ git tag -a v -m release +$ git push origin "$tag" --tags +# login to Github and create release +``` diff --git a/package.json b/package.json index d11c07e59..2d0c3e791 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "scripts": { "test": "eslint src && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html", "prepublishOnly": "npm run build", - "build": "make" + "build": "make", + "release": "./release.sh" }, "license": "BSD-3-Clause", "devDependencies": { diff --git a/release.sh b/release.sh new file mode 100755 index 000000000..aedb5472a --- /dev/null +++ b/release.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +set -e + +version="$1" +tag="v${version}" + +if [[ -z $version ]]; then + echo "First order argument of version required. i.e. ./bump 3.2.0" +fi + +if [[ $(git status --porcelain) ]]; then + echo "You cannot have any local changes to run release. Stash or commmit and rerun." + exit 1 +fi + +echo "Have you updated and commited the CHANGELOG? (y/n)" +read -r changelog_updated + +if [[ "$changelog_updated" != "y" ]]; then + echo "Update the changelog and commit then run release again." + exit 1 +fi + +echo "Creating release branch ${tag}." +git checkout -b "$tag" + +echo "Bumping version in package.json and package-lock.json, tagging, comiting and pushing to remote" +npm version --no-git-tag-version "$version" +$ git add package*.json +$ git commit -m "Update package*.json: " +git push origin "$tag" + +echo "Do you want to publish NPM? (y/n)" +read -r should_publish_npm + +if [[ "$should_publish_npm" == "y" ]]; then + npm login + npm publish +fi + +echo "Do you want to publish to the Mapbox CDN? (y/n)" +read -r should_publish_cdn + +if [[ "$should_publish_cdn" == "y" ]]; then + make + ./deploy.sh "$tag" +fi + +echo "Do you want to update and commit the documentation pages? (y/n)" +read -r should_update_documentation + +if [[ "$should_update_documentation" == "y" ]]; then + echo "Building docs" + ./_docs/build.sh "$tag" + + echo "Bumping version in publishers _config files" + find . -name '_config*.yml' -exec sed -i '' "s/^\\(\\s*mapboxjs\\s*:\\s*\\).*/\\1 ${version}/" {} \; + + echo "Commiting publisher _config files" + git add _config*.yml docs/* + git commit -m "Update docs: ${tag}" + + echo "Bumping version in package.json and package-lock.json, commiting and tagging" + npm version "$version" + git push origin "$tag" +fi