DEV Community

Hilton Meyer
Hilton Meyer

Posted on • Originally published at hiltonmeyer.com on

1 2

Travis build branch for github pages

In my article of automating my build process for a hosted server I was using the default of gh-pages branch. This is the vanilla out of the box branch used by Travis-CI. The issue is that this should be a clean branch because I was getting emails about issues with the build of the github.io page:

[bikingbadger/hiltonmeyer.com] Page build failure

The page build failed for the `gh-pages` branch with the following error

The tag `set` on line 14 in `feed.njk` is not a recognized Liquid tag

The error was that is was still looking at the nunjucks files so this was causing me some issues. Again I was using this branch as a hack to get around Travis being able to build the site for me and then I could clone it onto the hosted server. I don't like getting junk emails so looked into it a bit and found that I could simply give another target branch if I didn't want to use the default. I added the target_branch to parameter and it worked like a charm. This is the currently setup:

language: node_js
node_js:
  - 12
before_script:
  - npm install
script: npm run build
branches:
  except:
    - gh-pages
branches:
  only:
    - master    
sudo: false
os:
  - linux
deploy:
  provider: pages
  skip_cleanup: true
  github_token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
  keep_history: true
  target_branch: prod
  on:
    branch: master

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay