Publish your website to GitHub Pages.
-
Install
publish-gh-pages
package into your project.npm install publish-gh-pages
-
Initial Travis CI yml file.
gh-pages init
Using Travis CI publishing your site
- Go to https://github.com/settings/tokens and generate a new personal access token.
- Using your GitHub account, add the Travis CI app to the repository you want to activate.
- Open your Travis CI dashboard. The URL looks like https://travis-ci.com/USERNAME/REPO, and navigate to the
More options
>Setting
>Environment Variables
section of your repository. - Create a new environment variable named
GH_TOKEN
with your newly generated token as its value, thenGH_EMAIL
(your email address) andGH_NAME
(your GitHub username). - Check and modify a
.travis.yml
file on the root of your repository with proper setting.
Once you install publish-gh-pages
package, you can use command below:
gh-pages init
gh-pages publish
Use gh-pages init
to create needed config files.
- .gh-pages.json
- .travis.yml
In the root of project folder should has configuration file, .gh-pages.json
. It should following structure:
{
"projectName": "demo-web-app",
"organizationName": "poychang",
"buildCommand": "ng build --base-href /demo-web-app/",
"distRoot": "./dist",
"distFolder": "DemoWebApp",
"branch": "gh-pages",
"commit": "Update demonstration web app"
}