-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Use ta-scripts #153
Changes from all commits
6540a49
37130e1
1bd95bd
29dc69d
127868f
fd60d40
ea94e25
e7695aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ machine: | |
|
||
dependencies: | ||
pre: | ||
- pip install awscli | ||
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | ||
- npm install -g npm@3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: | ||
|
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) | ||
|
||
# | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
There was a problem hiding this comment.
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.