mithril-vndb/.travis.yml
2019-03-09 02:04:30 -05:00

104 lines
3.4 KiB
YAML

sudo: false
# Only care about running tests against latest node
language: node_js
node_js:
- node
# Keep node_modules around, it speeds up builds & they don't change often
cache:
directories:
- node_modules
# Custom install step so the travis-only stuff doesn't need to be in package.json
install:
- npm install
# This is to prevent lint-staged/prettier from running on the bundles
- npm rm husky
# Build bundles (so they're always up to date)
before_script:
- npm run build-browser
# Pass -save so it'll update the readme as well
- npm run build-min -- -save
# must run after build-min in order to generate min.mjs
- npm run build-esm
# Run tests, lint, and then check for perf regressions
script:
- npm test
- npm run perf
# After a successful build commit changes back to repo
after_success:
- |
# Set up SSH environment
$(npm bin)/set-up-ssh \
--key "$encrypted_016049456622_key" \
--iv "$encrypted_016049456622_iv" \
--path-encrypted-key "./.deploy.enc"
# Commit bundle changes generated in before_script step
# --commands is a weird no-op but required for commit-changes to run
# --branch arg is to ensure this only runs against the `next` branch
$(npm bin)/commit-changes \
--commands "echo committing" \
--commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
--branch "next"
# Only want to commit docs when building pushes on master &
# this doesn't have the built-in branch protection like commit-changes
if [ "$TRAVIS_EVENT_TYPE" == "push" ] && \
[ "$TRAVIS_BRANCH" == "master" ] && \
[ "$TRAVIS_REPO_SLUG" == "MithrilJS/mithril.js" ]
then
# Generate docs
npm run gendocs
# Set up git env
git config --global user.email "$GH_USER_EMAIL"
git config --global user.name "$GH_USER_NAME"
# Commit docs to gh-pages branch
# Using --add to ensure that archived versions aren't lost
# Using --repo to force it to go over SSH so the saved keys are used (tschaub/gh-pages#160)
$(npm bin)/gh-pages \
--dist ./dist \
--add \
--repo "git@github.com:MithrilJS/mithril.js.git" \
--message "Generated docs for commit $TRAVIS_COMMIT [skip ci]"
else
echo "Not submitting documentation updates"
fi
# Environment configuration
env:
global:
# Set up GH_USER_EMAIL & GH_USER_NAME env variables used by travis-scripts package
- secure: UdSk2uKTL56iOHkIZP9Tpj/OI8w26DRTs6INRq+peZKkHq8NVC0TmbtbpRoc5kxErovN2hyqsAnoMtXSQHKK+H9mpMx0v4ck/I+o2oEny/1hwi5YQ/Q0nAebVhZkgA3eVhJY1brK0bOlr8uI07m9mcPs3Qz0ramZutJQG7FdnZs=
# Deploy to npm and github pages on tagged commits that successfully build
deploy:
- provider: releases
api_key:
secure: BBlVwr3CRWS6Zmc8nsYMMN59P95g/lg9OzNCsP7uiFyu7mnC6VdOIgwmmJXBviUiEymbcdepgRqEdjHIoemg2YhM5IOnhMoYFrfMBoWUpMihpejFY8EVm3NrTh0prXgCHbp/3OktoKdOn/Zhc2z7cKDMeToHzaDStLtQPR8u9jU=
file:
- "mithril.js"
- "mithril.min.js"
- "mithril.mjs"
- "mithril.min.mjs"
skip_cleanup: true
draft: true
on:
tags: true
repo: MithrilJS/mithril.js
- provider: npm
skip_cleanup: true
email: me@isiahmeadows.com
api_key:
secure: "uPLbeJTalA/b38srb1VuWnD3eOgeKTkXf8VVUasUXIqc2xub4DSkFm1IVKSVd/rzP7EeO7+gRUs2UteNKlpZJl226IS5mFPSVtC7ViW46WSpYT0wlMsc7hrubMBGTx3/XYpPwtmMlTIGs5ICT7YkGAuju/6i79LDAB+gbnEY8Bc="
on:
tags: true
repo: MithrilJS/mithril.js
condition: "$TRAVIS_TAG != *-*"