Skip to content

Commit

Permalink
Merge branch 'master' of github.com:clay/amphora into modify-lists
Browse files Browse the repository at this point in the history
  • Loading branch information
jpope19 committed Jan 7, 2021
2 parents 6db3456 + 263d7e9 commit 17a2f6e
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 5 deletions.
37 changes: 33 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ references:
tags:
only: /.*/

filter_stg: &filter_stg
filter_stg: &filter_head
filters:
branches:
only: master
tags:
only: stg

filter_prd: &filter_prd
filter_prd: &filter_release
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+\.[0-9]+\.[0-9]+/
only: /v[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?/

jobs:

Expand Down Expand Up @@ -94,6 +94,26 @@ jobs:
paths:
- website/node_modules

deploy_package:
docker:
- image: circleci/node:12
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v3-node12-dependencies-{{ checksum "package.json" }}
- v3-node12-dependencies-
- run: npm install
- run: |
echo "$NPMRC" > ~/.npmrc
chmod 600 ~/.npmrc
if [[ "$CIRCLE_TAG" = *-* ]]; then
npm publish --tag=prerelease
else
npm publish
fi
workflows:
version: 2
test:
Expand All @@ -105,9 +125,18 @@ workflows:
- test_node14:
<<: *filter_all
- deploy_docs:
<<: *filter_head
context:
- Documentation
requires:
- test_node10
- test_node12
- test_node14
- deploy_package:
<<: *filter_release
context:
- npm-publish
requires:
- test_node10
- test_node12
- test_node14
<<: *filter_stg
45 changes: 45 additions & 0 deletions .circleci/scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# This script will increment the package version in package.json.
# It will then tag the HEAD of the master branch with the version number
# and push the tag to the origin (GitHub)

set -e

OPTIONS="(prepatch|patch|preminor|minor|premajor|major)"
USAGE="usage: npm release $OPTIONS"
SEMVAR="$1"

# Releases should only be cut from the master branch.
# They can be manually cut from other branches, but that should be a very
# intentional process.
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$BRANCH" != "master" ]]; then
>&2 echo "ERROR: Not on the master branch, will not release."
exit 1
fi

case $SEMVAR in
minor)
;;
major)
;;
patch)
;;
premajor)
;;
preminor)
;;
prepatch)
;;
*)
SEMVAR=prepatch
>&2 echo "WARNING: No $OPTIONS provided, defaulting to PREPATCH."
>&2 echo "$USAGE"
;;
esac

git pull --rebase origin master
version="$(npm version $SEMVAR)"
git push origin master
git push origin "tags/$version"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"test": "npm run eslint && npm run mocha",
"eslint": "eslint --max-warnings 0 lib test",
"mocha": "istanbul cover _mocha"
"mocha": "istanbul cover _mocha",
"release": "./.circleci/scripts/release.sh"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 17a2f6e

Please sign in to comment.