2017-01-11 deploying with github travis and unpkg
Releasing with github, travis and unpkg.
I have just released a small JavaScript library: “reun”. During this, I streamlined my release process, with the following file structure
- dynamic files
main.js
contains the codeREADME.md
contains documentation (may be autogenerated from code later on)package.json
contains the version number, and meta information (may be autogenerated from the code later on)
- project-specific files
icon.png
– icon for the project.travis.yml
– build recipe, need to runtravis setup npm
(andgem install travis
before that) to update it for new projects.CNAME
– set the domain for your website- (
config.xml
for cordova deployment, not in this project) - (
Dockerfile
for automatic building of image / server deployment, not in this project)
- generic files
index.html
– webpage for project that render README.md (or an app-entry loading main.js if it was an app instead of a library)dev.sh
– web server + live reload for use during developmentLICENSE
GPLv3.gitignore
ignore temporary files
When I bump the version number and commit to github, the following happens:
- GitHub makes the new version of the source code available on https://github.com/solsort/reun/.
- GitHub Pages updates the website on https://solsort.github.io/reun/.
- CloudFlare handles DNS, SSL, CDN, makes it available on https://reun.solsort.com/.
- Travis runs the tests, deploys the package to npmjs if successful. It shows the result on https://travis-ci.org/solsort/reun/.
- NPM now hosts a package of the latest version on https://www.npmjs.com/package/reun/.
- UNPKG now serves the package through the CDN on https://unpkg.com/reun/.
- (Docker Hub could automatically build and deploy an image to run on a server, and call a hook to reload the image)
- (PhoneGap Build could build the new version of the app to deploy on mobile phones).
This infrastructure is free for opensouce projects, and makes it trival/automatic to release new versions.