Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ta-scripts #153

Merged
merged 8 commits into from
Jan 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ For a listing of development commands use the following:
npm run # list npm commands
gulp help # list gulp commands

### Deploying
### Releasing

npm version <version> # bump the new version
git push # push bump commit
git push --tags # push version tag
On the latest clean `master`:

npm run release:major
npm run release:minor
npm run release:patch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Releases are now easy and explicit. Thanks to our ta-scripts package, they are also consistent across our projects.


## Contributing

Before submitting PRs please review our [Component Guidelines] and [Roadmap].

[.babelrc]: http://babeljs.io/docs/usage/babelrc/
Expand Down
3 changes: 2 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ machine:

dependencies:
pre:
- pip install awscli
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- npm install -g npm@3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awscli is used to sync to s3 (future dist assets). The ta-script package will handle installing it if it doesn't exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awscli is used to sync to s3 (future dist assets). The ta-script package will handle installing it if it doesn't exist.


test:
post:
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
"scripts": {
"clean": "while read line; do rm -rf $line; done < .gitignore",
"lint": "eslint . --format ./node_modules/eslint-friendly-formatter",
"lint-watch": "watch 'npm run lint' docs gulp src test",
"lint:watch": "watch 'npm run lint' docs gulp src test",
"release:major": "ta-script npm/release.sh -- major",
"release:minor": "ta-script npm/release.sh -- minor",
"release:patch": "ta-script npm/release.sh -- patch",
"start": "gulp",
"karma": "babel-node $(npm bin)/karma start",
"test": "npm run karma -- karma.conf.babel.js",
"test-watch": "webpack-dev-server --config webpack.tests.babel.js"
"test:watch": "webpack-dev-server --config webpack.tests.babel.js"
},
"pre-commit": "lint",
"repository": {
Expand All @@ -39,6 +42,7 @@
"react-dom": "^0.14.0"
},
"devDependencies": {
"@technologyadvice/ta-scripts": "^1.3.0",
"babel-cli": "^6.3.17",
"babel-core": "^6.3.2",
"babel-eslint": "^4.1.6",
Expand Down
40 changes: 2 additions & 38 deletions scripts/circle_deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env bash

NPM_PACKAGE_NAME=$(json -f package.json name)
NPM_PACKAGE_VERSION=$(json -f package.json version)

#
Expand All @@ -14,49 +13,14 @@ git config --global push.default simple
# generate changelog
#
echo "...generating changelog"
curl -X POST github-changelog-api.herokuapp.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME \
| json contents > CHANGELOG.md

git add CHANGELOG.md

if [[ -n $(git status --porcelain) ]]; then
echo "...starting push, CHANGELOG.md is dirty after build"
git commit -n -m "deploy CHANGELOG.md by $CIRCLE_USERNAME [ci skip]"
git push origin $CIRCLE_BRANCH
else
echo "...skipping push, repo is clean after build"
fi
ta-script circle_ci/create_changelog
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple changelogs!


#
# s3 sync
#
SOURCE_DIRECTORY=./dist
S3_BUCKET=ta-stardust-assets

echo "...syncing with s3"
aws s3 sync ${SOURCE_DIRECTORY} s3://${S3_BUCKET}/${NPM_PACKAGE_VERSION}/ --delete --acl public-read
ta-script aws/s3_sync -d ./dist -b "ta-stardust-assets/$NPM_PACKAGE_VERSION"

#
# npm publish
#
echo "...checking if $NPM_PACKAGE_NAME@$NPM_PACKAGE_VERSION is already published"

NPM_PUBLISHED_VERSIONS=$(npm view ${NPM_PACKAGE_NAME} versions | sed "s/[][',]//g")
NPM_IS_PUBLISHED=false

for ver in ${NPM_PUBLISHED_VERSIONS[@]}; do
[[ ${NPM_PACKAGE_VERSION} == ${ver} ]] && NPM_IS_PUBLISHED=true
done

if ${NPM_IS_PUBLISHED}; then
echo "...$NPM_PACKAGE_NAME@$NPM_PACKAGE_VERSION is already published"
else
echo "...publishing $NPM_PACKAGE_NAME@$NPM_PACKAGE_VERSION"
echo "...writing ~/.npmrc"
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
echo "...publishing"
npm publish
fi

#
# gh-pages
Expand Down