Search code examples
githubgulpgithub-pages

Publishing built html files with github


I have a file src/test/html/index.html that first needs to be compiled to target/test/html/index.html and at this point I want it to be the project page for the repository.

I have a gulp task that is responsible for performing the build at the root of the repository. The command that performs the build is gulp build:css && gulp test:css. Once that's done it creates the target/test/html/index.html.

Is there a way to both perform the build on github and tell github to use the built page target/test/html/index.html as the gh-pages home page?


Solution

  • You can use a build Server to perform that Task. In one of the Projects I am contributing to we are using travis to build a Webpage. In our case the Story is a Little bit more complex because I wanted travis to create a pull-request containing the latest changes instead of commiting the files instantly.

    You can see the code I build some months ago to perform that Task l.60ff. here. You will also Need to create a technical user that will be able to push changes to your repository. Travis provides ways to encrypt the stored credentials.