Home

Awesome

deployable.site

See this project deployed at https://deployable.site

This repo simply serves as a very minimalist progressive web app boilerplate. The README however is a step-by-step guide demonstrating how to properly deploy a static web application (such as this) to GitHub pages without ever checking in built assets or directly pushing to the gh-pages branch. This approach was pieced together from various blog posts and stackoverflow answers, making the most of free services provided by GitHub, TravisCI and CloudFlare to promote applying industry standard workflows to open source apps; review, build, test, deploy and serve over https for free with almost no configuration! Or servers for that matter :fishing_pole_and_fish:

<hr/>

:angel: You need a free TravisCI account and CloudFlare basic account (if you require custom https domains)

<hr/>

Setup Overview

  1. Prepare Project: create a deployable project repository or use a fork of this repo
  2. Obtain Token: one per project from here, copy it and use as the value of GITHUB_TOKEN in travis
  3. Enable TravisCI: switch on builds for the project here and add the GITHUB_TOKEN environment variable
  4. Configure Build: add a file like this to the project root and configure for your application
  5. Trigger Deploy: push to master or merge a pull request to invoke a full build and deploy :boom:
<br/>

1. Prepare Project

This structure of this repository adheres to a deployable configuration but that doesn't mean you have to use this code as a basis for your deployable project. This approach will work with almost any static site architecture, framework or build pipeline. The important things to recognize are:

If your project does not meet all the deployable requirements then you can clone/fork this repository and build upon it or tweak your project to fit.

<br/>

2. Obtain Token

ezgif com-video-to-gif

<hr/>
  1. Navigate to GitHub Personal Access Token Settings
  2. Enter a Token Description and select the repo scope
  3. Scroll down and click Generate Token
  4. Copy the generated access token to clipboard
<br/>

3. Enable TravisCI

ezgif com-gif-maker

<hr/>
  1. Visit your TravisCI Dashboard and find the deployable repository
  2. Turn on the project switch and click the settings icon
  3. Turn on both Auto Cancellation switches
  4. Under Environment Variables enter GITHUB_TOKEN as Name
  5. Paste the generated access token as Value and click Add
<br/>

4. Configure Build

If you do not have a domain name for your project then use *.deployable.site where * is any namespace that has not already been taken by another deployer. Choosing this option limits your site to http only.

language: node_js
node_js:
- "7"

script: npm run build               // The script that builds the app

deploy:
  local_dir: dist                   // The distributed output directory                  
  fqdn: deployable.site             // The domain name of the deployed site
  provider: pages
  skip_cleanup: true
  github_token: $GITHUB_TOKEN
  on:
    branch: master
<hr/>
  1. Clone the deployable project to your local machine
  2. Add a travis.yml file like the one above to the project root
  3. Update script attribute with the command that builds your project
  4. Update local_dir attribute with the name of the project output directory
  5. Update fqdn attribute with the domain name the project should be deployed
<br/>

5. Trigger Deploy

  1. Add and commit the changes to travis.yml then git push
  2. Check the build and deploy progress on TravisCI
  3. When the build succeeds visit your shiny new site at the domain you specified