From de118acef1233def202902b29f8b12b0214df10b Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 10:57:06 -0600 Subject: [PATCH 01/11] Add release.sh: automated releases! --- DEPLOYING.md | 40 -------------------------------------- RELEASE.md | 22 +++++++++++++++++++++ package.json | 3 ++- release.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 41 deletions(-) delete mode 100644 DEPLOYING.md create mode 100644 RELEASE.md create mode 100755 release.sh 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..eb87c2d92 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,22 @@ +# Creating a release of mapbox.js + +### Before Deploying + +* You need to have the AWS CLI installed. `pip install awscli` +* Write a `CHANGELOG.md` entry that describes your changes and links to + issues in question + +### Automated Deployement + +`npm run release ` + +### Manual Deployement + +* Update `_config.yaml`, `_config.publisher-production.yml`, `_config.publisher-staging.yml` +* Build docs. `./deploy.sh v` +* Commit docs. +* Bump version and tag. `npm version ` +* Push to Github. `git push origin publisher-production --tags` +* Build `mapbox.js` `make` +* Publish to CDN. `./deploy.sh v` +* Publish to NPM. `mbx npm publish` \ No newline at end of file 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..92faa1830 --- /dev/null +++ b/release.sh @@ -0,0 +1,54 @@ +#!/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 "Bumping version in publishers _config files" +find . -name '_config*.yml' -exec sed -i '' "s/^\\(\\s*mapboxjs\\s*:\\s*\\).*/\\1 ${version}/" {} \; + +echo "Commiting publishers _config files" +git add _config*.yml +git commit -m "Update _config*.yml: ${tag}" + +echo "Building docs" +./_docs/build.sh "$tag" +git add 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 publisher-production --tags + +echo "Do you want to publish to our CDN? (y/n)" +read -r should_publish_cdn + +if [[ "$should_publish_cdn" == "y" ]]; then + make + ./deploy.sh "$tag" +fi + +echo "Do you want to publish NPM? (y/n)" +read -r should_publish_npm + +if [[ "$should_publish_npm" == "y" ]]; then + mbx npm publish +fi From e56aa5d7c0ba6b26673815063ec1b3395745e28c Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 12:13:42 -0600 Subject: [PATCH 02/11] Update release.sh: change docs gen logic Updating the _config*.yml versions and docs generation should be commited together. --- release.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/release.sh b/release.sh index 92faa1830..35857b0f6 100755 --- a/release.sh +++ b/release.sh @@ -22,16 +22,14 @@ if [[ "$changelog_updated" != "y" ]]; then exit 1 fi +echo "Commiting publishers _config files" echo "Bumping version in publishers _config files" find . -name '_config*.yml' -exec sed -i '' "s/^\\(\\s*mapboxjs\\s*:\\s*\\).*/\\1 ${version}/" {} \; -echo "Commiting publishers _config files" -git add _config*.yml -git commit -m "Update _config*.yml: ${tag}" - echo "Building docs" ./_docs/build.sh "$tag" -git add docs/* + +git add _config*.yml docs/* git commit -m "Update docs: ${tag}" echo "Bumping version in package.json and package-lock.json, commiting and tagging" From f25a16cd8ee37bda14ba185c1a42e3569fcbfa66 Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 14:26:55 -0600 Subject: [PATCH 03/11] Update release.sh/RELEASE.md: npm publish --- RELEASE.md | 2 +- release.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index eb87c2d92..63e7ac49c 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -19,4 +19,4 @@ * Push to Github. `git push origin publisher-production --tags` * Build `mapbox.js` `make` * Publish to CDN. `./deploy.sh v` -* Publish to NPM. `mbx npm publish` \ No newline at end of file +* Publish to NPM. `npm publish` \ No newline at end of file diff --git a/release.sh b/release.sh index 35857b0f6..cd6ee4967 100755 --- a/release.sh +++ b/release.sh @@ -48,5 +48,6 @@ echo "Do you want to publish NPM? (y/n)" read -r should_publish_npm if [[ "$should_publish_npm" == "y" ]]; then - mbx npm publish + npm login + npm publish fi From 53b2369780ed06f9c31e4c24a3ec4806da1ab704 Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 15:28:23 -0600 Subject: [PATCH 04/11] Update RELEASE.md/release.sh: update order --- RELEASE.md | 9 ++++----- release.sh | 43 ++++++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 63e7ac49c..161345686 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -12,11 +12,10 @@ ### Manual Deployement -* Update `_config.yaml`, `_config.publisher-production.yml`, `_config.publisher-staging.yml` -* Build docs. `./deploy.sh v` -* Commit docs. * Bump version and tag. `npm version ` * Push to Github. `git push origin publisher-production --tags` -* Build `mapbox.js` `make` +* Publish to NPM. `npm publish` * Publish to CDN. `./deploy.sh v` -* Publish to NPM. `npm publish` \ No newline at end of file +* Update `_config.yaml`, `_config.publisher-production.yml`, `_config.publisher-staging.yml` +* Build docs. `./deploy.sh v` +* Commit docs. diff --git a/release.sh b/release.sh index cd6ee4967..c62818a20 100755 --- a/release.sh +++ b/release.sh @@ -22,21 +22,19 @@ if [[ "$changelog_updated" != "y" ]]; then exit 1 fi -echo "Commiting publishers _config files" -echo "Bumping version in publishers _config files" -find . -name '_config*.yml' -exec sed -i '' "s/^\\(\\s*mapboxjs\\s*:\\s*\\).*/\\1 ${version}/" {} \; - -echo "Building docs" -./_docs/build.sh "$tag" - -git add _config*.yml docs/* -git commit -m "Update docs: ${tag}" - -echo "Bumping version in package.json and package-lock.json, commiting and tagging" +echo "Bumping version in package.json and package-lock.json, tagging, comiting and pushing to remote" npm version "$version" git push origin publisher-production --tags -echo "Do you want to publish to our CDN? (y/n)" +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 @@ -44,10 +42,21 @@ if [[ "$should_publish_cdn" == "y" ]]; then ./deploy.sh "$tag" fi -echo "Do you want to publish NPM? (y/n)" -read -r should_publish_npm +echo "Do you want to update and commit the documentation pages? (y/n)" +read -r should_update_documentation -if [[ "$should_publish_npm" == "y" ]]; then - npm login - npm publish +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 publisher-production fi From 81aee23575c5c132de0fff13ecf21fbd8cce0fcb Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 16:54:41 -0600 Subject: [PATCH 05/11] Update RELEASE.md: clarify --- RELEASE.md | 64 ++++++++++++++++++++++++++++++++++++++++++------------ release.sh | 11 +++++++--- 2 files changed, 58 insertions(+), 17 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 161345686..0e8fc16da 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,21 +1,57 @@ # Creating a release of mapbox.js -### Before Deploying +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. -* You need to have the AWS CLI installed. `pip install awscli` -* Write a `CHANGELOG.md` entry that describes your changes and links to - issues in question +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) -### Automated Deployement +## Release part 1: from release branch (version bump, cdn publish, npm publish, docs generation) -`npm run release ` +### Option 1: Automated release +Update to your version. i.e. 3.2.1 -### Manual Deployement +```terminal +$ npm run release +``` -* Bump version and tag. `npm version ` -* Push to Github. `git push origin publisher-production --tags` -* Publish to NPM. `npm publish` -* Publish to CDN. `./deploy.sh v` -* Update `_config.yaml`, `_config.publisher-production.yml`, `_config.publisher-staging.yml` -* Build docs. `./deploy.sh v` -* Commit docs. +### Option 2: Manual release + +Update to your version. i.e. 3.2.1 + +```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/*: " +``` + +### Release part 2: from publisher-production branch (tag and 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 +``` \ No newline at end of file diff --git a/release.sh b/release.sh index c62818a20..aedb5472a 100755 --- a/release.sh +++ b/release.sh @@ -22,9 +22,14 @@ if [[ "$changelog_updated" != "y" ]]; then 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 "$version" -git push origin publisher-production --tags +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 @@ -58,5 +63,5 @@ if [[ "$should_update_documentation" == "y" ]]; then echo "Bumping version in package.json and package-lock.json, commiting and tagging" npm version "$version" - git push origin publisher-production + git push origin "$tag" fi From 67204f3c3ed9b92d5121a00d80cc43bb133959fa Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 16:57:37 -0600 Subject: [PATCH 06/11] Update RELEASE.md --- RELEASE.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 0e8fc16da..20a39b0ce 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -11,17 +11,16 @@ Checklist: ## Release part 1: from release branch (version bump, cdn publish, npm publish, docs generation) -### Option 1: Automated release Update to your version. i.e. 3.2.1 +### Option 1: Automated release + ```terminal $ npm run release ``` ### Option 2: Manual release -Update to your version. i.e. 3.2.1 - ```terminal # Bump version $ npm version --no-git-tag-version @@ -54,4 +53,4 @@ $ git pull origin publisher-production $ git tag -a v -m release $ git push origin "$tag" --tags # login to Github and create release -``` \ No newline at end of file +``` From ffd70afeabedfcbf8d37495e25e3bb3fb71656f2 Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 16:58:15 -0600 Subject: [PATCH 07/11] Update RELEASE.md --- RELEASE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 20a39b0ce..8e25fbed9 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -9,7 +9,7 @@ Checklist: - [ ] Merge release branch into `publisher-production` - [ ] Finalize the release (part 2) -## Release part 1: from release branch (version bump, cdn publish, npm publish, docs generation) +## Part 1: from release branch (version bump, cdn publish, npm publish, docs generation) Update to your version. i.e. 3.2.1 @@ -45,7 +45,7 @@ $ git add _config*.yml docs/* $ git commit -m "Update docs/*: " ``` -### Release part 2: from publisher-production branch (tag and release) +### Part 2: from publisher-production branch (tag and release) ```terminal $ git checkout publisher-production From baaff64628868dedcbd32cf3c6ad3ce5112bfec0 Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 16:58:47 -0600 Subject: [PATCH 08/11] Update RELEASE.md --- RELEASE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 8e25fbed9..e123a28e8 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -9,7 +9,7 @@ Checklist: - [ ] Merge release branch into `publisher-production` - [ ] Finalize the release (part 2) -## Part 1: from release branch (version bump, cdn publish, npm publish, docs generation) +## Part 1: [release branch] (version bump, cdn publish, npm publish, docs generation) Update to your version. i.e. 3.2.1 @@ -45,7 +45,7 @@ $ git add _config*.yml docs/* $ git commit -m "Update docs/*: " ``` -### Part 2: from publisher-production branch (tag and release) +### Part 2: [publisher-production branch] (tag and release) ```terminal $ git checkout publisher-production From 008cfc288e35f560105a56f7f345a90224f91b1d Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 17:00:20 -0600 Subject: [PATCH 09/11] Update RELEASE.md --- RELEASE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index e123a28e8..fecb64864 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -9,7 +9,7 @@ Checklist: - [ ] Merge release branch into `publisher-production` - [ ] Finalize the release (part 2) -## Part 1: [release branch] (version bump, cdn publish, npm publish, docs generation) +## Part 1: [branch=release-branch] (version bump, cdn publish, npm publish, docs generation) Update to your version. i.e. 3.2.1 @@ -45,7 +45,7 @@ $ git add _config*.yml docs/* $ git commit -m "Update docs/*: " ``` -### Part 2: [publisher-production branch] (tag and release) +## Part 2: [branch=publisher-production] (tag and release) ```terminal $ git checkout publisher-production From 11607c85e0b90e43de5650e62054f93f62080b34 Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 17:06:56 -0600 Subject: [PATCH 10/11] Update RELEASE.md --- RELEASE.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index fecb64864..5de2b6381 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -9,9 +9,15 @@ Checklist: - [ ] Merge release branch into `publisher-production` - [ ] Finalize the release (part 2) -## Part 1: [branch=release-branch] (version bump, cdn publish, npm publish, docs generation) +> Replace any instance of with your version -Update to your version. i.e. 3.2.1 +## 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 1: Automated release @@ -45,7 +51,11 @@ $ git add _config*.yml docs/* $ git commit -m "Update docs/*: " ``` -## Part 2: [branch=publisher-production] (tag and release) +## 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 From b21e346f6de11f397e4452d239b86bfdb3cbd16b Mon Sep 17 00:00:00 2001 From: Yves Richard Date: Thu, 17 Oct 2019 17:10:44 -0600 Subject: [PATCH 11/11] Update RELEASE.md --- RELEASE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 5de2b6381..7b5e977c1 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -19,13 +19,13 @@ Checklist: - npm publish - generate docs pages -### Option 1: Automated release +### Option A: Automated release ```terminal $ npm run release ``` -### Option 2: Manual release +### Option B: Manual release ```terminal # Bump version