Skip to content

Commit

Permalink
Release with travis (video-dev#1810)
Browse files Browse the repository at this point in the history
- Automatically publish a new NPM package when a new git tag is pushed
- Create a draft github release and add the build files as attachments
  • Loading branch information
tjenkinson authored and johnBartos committed Aug 9, 2018
1 parent c721b7e commit 79a81e3
Show file tree
Hide file tree
Showing 23 changed files with 2,005 additions and 37,123 deletions.
1 change: 0 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ npm run test

- Use [EditorConfig](http://editorconfig.org/) or at least stay consistent to the file formats defined in the `.editorconfig` file.
- Develop in a topic branch, not master
- Don't commit the updated `dist/hls.js` file in your PR. We'll take care of generating an updated build right before releasing a new tagged version.

Thanks! :heart: :heart: :heart:
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
### Checklist

- [ ] changes have been done against master branch, and PR does not conflict
- [ ] no commits have been done in dist folder (we will take care of updating it)
- [ ] new unit / functional tests have been added (whenever applicable)
- [ ] API or design changes are documented in API.md
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ coverage/

.idea/*

# Build reports
dist/bundle-analyzer-report.*
# Build
/dist
50 changes: 33 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,64 @@ sudo: required
# before_install: if [ "${TRAVIS_MODE}" != "funcTests" ]; then unset SAUCE_USERNAME && unset SAUCE_ACCESS_KEY; fi
script: ./scripts/travis.sh
after_script: if [ "${TRAVIS_MODE}" = "funcTests" ]; then echo -n "travis_fold:start:sauce_logs\nSauce connect log:\n" && cat /home/travis/sauce-connect.log && echo -n "\ntravis_fold:end:sauce_logs\n"; fi
after_success: npm run coverage
env:
global:
- SAUCE_USERNAME=mangui
stages:
- required
- optional
- buildAndTest
- releaseCanary
- release
- testFuncRequired
- testFuncOptional
jobs:
# stage: optional is allowed to be failure
fast_finish: true
allow_failures:
- stage: optional
- stage: testFuncOptional
include:
# https://docs.travis-ci.com/user/build-stages/deploy-github-releases/
- stage: release
if: tag IS present
env: TRAVIS_MODE=release
deploy:
provider: releases
api_key:
secure: "kR9xHKhWfOv6vwxz1d//PpC22VDupnPI59L9czLkpLoIdzm5rm3eV7he4XPlQfbSrV1UBgURARgF+yekmeqUZk9vqfo4F5oa+6KiBxAdnI9PjsjYRSXitdq4a6kpIR854nxUIOlDXR5AbD2MgNaKsQHiaNlngdR/870OhiwqRJVwQOLKVUADw1QWECXe/DXrQiFbMunxBrTyutbrGuI8cT7wzqFn+aPkI/3liiw8PTr93GrtxZ/bFxI899KzMSHHMXB+eDDMtxPFD+VApruD7h6f+1C0psJeOV8/PkzrRkbPELPBKKaPH9TvVOPUf2OSRHVna828wnLHwseae0rgtuk7+ZJmB9XZKX9FUBDT4/Gv/AkE+m/cwnoqaatAMJYR+yiQqsosjBLDAaTUOPHu3wBdAaR5uL5fGsSsKe3sUfSQHrv86vReNl9ETU06apmyWtsIbyhMtv98j9I+hNVjKZUI30g1ee6LgjlDlBavMk8KAbLbyBTcJlNAexj8Rppdqg+AdW7rYW+S6SgfTyyYQKTLeFwmDjfrkqzHJnk78sV18+xPLI1hbzBGp/bXaW23sLDBLLV5Sxifr8flUMkUdH28zsLCHUQ7C4GKQ19el2NZgIxSsnxRA8vGZof7OXasR4HJVjv/PSx+DN6Fi1PV1SiNBcwgPCGIIxBF7TUPxJk="
file_glob: true
file: dist/*
draft: true
skip_cleanup: true
on:
tags: true
# publish canary package if on master
- stage: required
- stage: releaseCanary
if: branch = master AND type != pull_request
env: TRAVIS_MODE=releaseCanary
# Required tests
- stage: required
- stage: buildAndTest
env: TRAVIS_MODE=build
- stage: required
- stage: buildAndTest
env: TRAVIS_MODE=unitTests
- stage: required
- stage: testFuncRequired
env: TRAVIS_MODE=funcTests UA=chrome OS="Windows 10"
# Optional Func tests
- stage: optional
- stage: testFuncOptional
env: TRAVIS_MODE=funcTests UA=firefox OS="Windows 10"
- stage: optional
- stage: testFuncOptional
env: TRAVIS_MODE=funcTests UA=chrome OS="Windows 7"
- stage: optional
- stage: testFuncOptional
env: TRAVIS_MODE=funcTests UA=firefox OS="Windows 7"
# - stage: optional
# - stage: testFuncOptional
# env: TRAVIS_MODE=funcTests UA=MicrosoftEdge OS="Windows 10"
- stage: optional
- stage: testFuncOptional
env: TRAVIS_MODE=funcTests UA="internet explorer" OS="Windows 8.1" UA_VERSION="11.0"
- stage: optional
- stage: testFuncOptional
env: TRAVIS_MODE=funcTests UA="internet explorer" OS="Windows 10"
- stage: optional
- stage: testFuncOptional
env: TRAVIS_MODE=funcTests UA=chrome OS="OS X 10.11"
# - stage: optional
# - stage: testFuncOptional
# env: TRAVIS_MODE=funcTests UA=firefox OS="OS X 10.11"
- stage: optional
- stage: testFuncOptional
env: TRAVIS_MODE=funcTests UA=safari OS="OS X 10.11" UA_VERSION="9.0"
addons:
sauce_connect: true
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ hls.js is written in [ECMAScript6], and transpiled in ECMAScript5 using [Babel].
[https://video-dev.github.io/hls.js/demo](https://video-dev.github.io/hls.js/demo)

### Canary
[https://video-dev.github.io/hls.js/demo?canary=true](https://video-dev.github.io/hls.js/demo?canary=true)
[https://video-dev.github.io/hls.js/demo?version=canary](https://video-dev.github.io/hls.js/demo?version=canary)

### Local
[https://video-dev.github.io/hls.js/demo?version=local](https://video-dev.github.io/hls.js/demo?version=local)

## Getting Started

Expand Down
24 changes: 20 additions & 4 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,26 @@ <h4>Buffer &amp; Statistics</h4>
document.body.appendChild(s);
}

// load compiled lib dist, or latest canary from jsdelivr (?canary=true)
var src = window.location.search.substring(1).split('&').indexOf('canary=true') >= 0
? 'https://cdn.jsdelivr.net/npm/hls.js@canary'
: '../dist/hls.js';
var LOCAL_SRC = '../dist/hls.js';
var LATEST_SRC = 'https://cdn.jsdelivr.net/npm/hls.js@latest';

var queryParts = window.location.search.substring(1).split('&');
var src = null;
if (queryParts.indexOf('version=latest') >= 0) {
src = LATEST_SRC;
} else if (queryParts.indexOf('version=canary') >= 0 || queryParts.indexOf('canary=true') >= 0) {
src = 'https://cdn.jsdelivr.net/npm/hls.js@canary';
} else if (queryParts.indexOf('version=local') >= 0) {
src = LOCAL_SRC;
}
if (!src) {
if (window.location.port) {
// we are not on port 80/443. Probably running locally. default to local
src = LOCAL_SRC;
} else {
src = LATEST_SRC;
}
}

loadScript(src, function() {
// load compiled demo main
Expand Down
Loading

0 comments on commit 79a81e3

Please sign in to comment.