Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Add release.sh: automated releases!
Browse files Browse the repository at this point in the history
  • Loading branch information
Yves Richard committed Oct 17, 2019
1 parent 157fc7d commit 9d64a4c
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 41 deletions.
40 changes: 0 additions & 40 deletions DEPLOYING.md

This file was deleted.

20 changes: 20 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Creating a release of mapbox.js

* 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 <major.minor.patch>`

### Manual Deployement:

* Update `_config.yaml`, `_config.publisher-production.yml`, `_config.publisher-staging.yml`
* Build docs. `./deploy.sh v<major.minor.patch>`
* Commit docs.
* Bump version and tag. `npm version <major.minor.patch>`
* Push to Github. `git push origin publisher-production --tags`
* Build `mapbox.js` `make`
* Publish to CDN. `./deploy.sh v<major.minor.patch>`
* Publish to NPM. `mbx npm publish`
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
54 changes: 54 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9d64a4c

Please sign in to comment.