refactor: Use Travis for npm publishing (#1538)
This commit is contained in:
parent
9cabdb94aa
commit
74c6b3e97b
2 changed files with 58 additions and 39 deletions
33
.travis.yml
33
.travis.yml
|
|
@ -1,31 +1,33 @@
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
|
# Only care about running tests against latest node
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- node
|
- node
|
||||||
|
|
||||||
|
# Keep node_modules around, it speeds up builds & they don't change often
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- node_modules
|
- node_modules
|
||||||
|
|
||||||
# Custom install step so the travis scripts don't need to be in package.json
|
# Custom install step so the travis scripts don't need to be in package.json
|
||||||
install:
|
install:
|
||||||
- npm install
|
- npm install
|
||||||
- npm install @alrra/travis-scripts@^3.0.1
|
- npm install @alrra/travis-scripts@^3.0.1
|
||||||
|
|
||||||
# Lint (but don't fail build) before running tests
|
# Bundle before running tests so the bundle is always up-to-date
|
||||||
before_script: npm run lint || true
|
before_script: npm run build
|
||||||
|
|
||||||
# Run more than just npm test
|
# This is the default, but leaving so it is obvious
|
||||||
script: npm run build && npm test
|
# script: npm test
|
||||||
|
|
||||||
# After a successful build create bundles & commit back to the repo
|
# After a successful build create bundles & commit back to the repo
|
||||||
after_success:
|
after_success:
|
||||||
- |
|
- |
|
||||||
|
|
||||||
# Only want to commit things on commits to $BRANCH
|
# Only want to commit things on $BRANCH
|
||||||
if [ "$TRAVIS_EVENT_TYPE" == "pull_request" ] || [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
|
if [ "$TRAVIS_EVENT_TYPE" == "pull_request" ] || [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
|
||||||
echo "Artifacts only built on $BRANCH"
|
echo "Artifacts only committed on $BRANCH"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -34,10 +36,11 @@ after_success:
|
||||||
--iv "$encrypted_8b86e0359d64_iv" \
|
--iv "$encrypted_8b86e0359d64_iv" \
|
||||||
--path-encrypted-key "./.deploy.enc"
|
--path-encrypted-key "./.deploy.enc"
|
||||||
|
|
||||||
# Build & commit changes
|
# Commit changes (if there were any) from running build earlier
|
||||||
$(npm bin)/commit-changes --commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
|
$(npm bin)/commit-changes --commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
|
||||||
--branch "$BRANCH"
|
--branch "$BRANCH"
|
||||||
|
|
||||||
|
# Environment configuration
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
# Restrict the branch this will activate on
|
# Restrict the branch this will activate on
|
||||||
|
|
@ -46,3 +49,15 @@ env:
|
||||||
# Set up GH_USER_EMAIL & GH_USER_NAME env variables used by travis-scripts package
|
# Set up GH_USER_EMAIL & GH_USER_NAME env variables used by travis-scripts package
|
||||||
- secure: Xvqvm3+PvJu/rs3jl/NNn0RWLkkLkIoPHiL0GCfVRaywgjCYVN02g54NVvIDaOfybqPmu9E6PJFVs92vhF34NMFQHf4EWskynusIGV271R2BV0i+OJBfLMuLgiwm6zRn7/Zw4JvWIUGEwcnlz0qxbqdHsS0SOR3fIkFzePickW0=
|
- secure: Xvqvm3+PvJu/rs3jl/NNn0RWLkkLkIoPHiL0GCfVRaywgjCYVN02g54NVvIDaOfybqPmu9E6PJFVs92vhF34NMFQHf4EWskynusIGV271R2BV0i+OJBfLMuLgiwm6zRn7/Zw4JvWIUGEwcnlz0qxbqdHsS0SOR3fIkFzePickW0=
|
||||||
- secure: Rf/ldEO9d4vItJhe6EmqWpFAyCARzoCb422nHnjr1hYJknnwIXpgyZ1C/7On/9o7rWPPf+8WcHC/rgjK2rthKCldzdG5I60LfWSNzap9lk3Aa4TpSCoDBuEp7JVvDr5tc3rKnBXVT71hOay7RSx1StWzXiJs9mjaeVMJzYzRT78=
|
- secure: Rf/ldEO9d4vItJhe6EmqWpFAyCARzoCb422nHnjr1hYJknnwIXpgyZ1C/7On/9o7rWPPf+8WcHC/rgjK2rthKCldzdG5I60LfWSNzap9lk3Aa4TpSCoDBuEp7JVvDr5tc3rKnBXVT71hOay7RSx1StWzXiJs9mjaeVMJzYzRT78=
|
||||||
|
|
||||||
|
# Deploy to npm on tagged commits that successfully build
|
||||||
|
deploy:
|
||||||
|
provider: npm
|
||||||
|
email: npm@patcavit.com
|
||||||
|
skip_cleanup: true
|
||||||
|
api_key:
|
||||||
|
secure: ADElvD1oxn9GfEG7dDOggX96b36A/cGEybovAc0221CCKzv5kWCavMrtxneiJYI6N/n24abSlbM90vMfU84FEzH0Ev28dGVokRP4ad6VRkISszKlYVEP8Lds4QxfKh78jZlUxmxM0B3vmQ1kYJbTBqp3ICtaJ5ptEQHWhrLtxnc=
|
||||||
|
on:
|
||||||
|
tags: true
|
||||||
|
repo: lhorie/mithril.js
|
||||||
|
branch: rewrite
|
||||||
|
|
|
||||||
64
package.json
64
package.json
|
|
@ -1,32 +1,36 @@
|
||||||
{
|
{
|
||||||
"name": "mithril",
|
"name": "mithril",
|
||||||
"version": "1.0.0-rc.7",
|
"version": "1.0.0-rc.7",
|
||||||
"description": "A framework for building brilliant applications",
|
"description": "A framework for building brilliant applications",
|
||||||
"author": "Leo Horie",
|
"author": "Leo Horie",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": "lhorie/mithril.js",
|
"repository": "lhorie/mithril.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node bundler/cli browser.js -o mithril.js -w",
|
"dev": "node bundler/cli browser.js -o mithril.js -w",
|
||||||
"build": "npm run build-browser & npm run build-min",
|
"build": "npm run build-browser & npm run build-min",
|
||||||
"build-browser": "node bundler/cli browser.js -o mithril.js",
|
"build-browser": "node bundler/cli browser.js -o mithril.js",
|
||||||
"build-min": "node bundler/cli browser.js -o mithril.min.js -m",
|
"build-min": "node bundler/cli browser.js -o mithril.min.js -m",
|
||||||
"lintdocs": "node docs/lint",
|
"lintdocs": "node docs/lint",
|
||||||
"gendocs": "node docs/generate",
|
"gendocs": "node docs/generate",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"test": "node ospec/bin/ospec",
|
"test": "node ospec/bin/ospec",
|
||||||
"cover": "istanbul cover --print both ospec/bin/ospec"
|
"posttest": "npm run lint || true",
|
||||||
},
|
"cover": "istanbul cover --print both ospec/bin/ospec",
|
||||||
"devDependencies": {
|
"preversion": "npm run test",
|
||||||
"eslint": "^2.10.2",
|
"version": "npm run build && git add mithril.js mithril.min.js",
|
||||||
"istanbul": "^0.4.3",
|
"postversion": "git push --follow-tags"
|
||||||
"marked": "^0.3.6"
|
},
|
||||||
},
|
"devDependencies": {
|
||||||
"publishConfig": {
|
"eslint": "^2.10.2",
|
||||||
"tag": "rewrite"
|
"istanbul": "^0.4.3",
|
||||||
},
|
"marked": "^0.3.6"
|
||||||
"bin": {
|
},
|
||||||
"ospec": "./ospec/bin/ospec",
|
"publishConfig": {
|
||||||
"bundle": "./bundler/bin/bundle"
|
"tag": "rewrite"
|
||||||
}
|
},
|
||||||
|
"bin": {
|
||||||
|
"ospec": "./ospec/bin/ospec",
|
||||||
|
"bundle": "./bundler/bin/bundle"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue