January 3, 2020

How to deploy Jigsaw static website using Github Actions

A while ago I wrote detailed tutorial on how to deploy Serverless applications using Github Actions.

In this article I'm going to share my deployment flow I use to deploy my personal website built on Jigsaw to Github Pages.

The deployment process consists of several sequential steps:

  • Checkout a repository;
  • Install NPM dependencies;
  • Install Composer dependencies;
  • Buid a website using npm run production command;
  • Add and commit build_production branch to local repository;
  • Push build_production branch to gh-pages branch on remote repository;

You may see entire deployment script on the gist below:

A few other notes:

  • If you're willing to use custom domain name, you also need to create a CNAME file containing your domain name;
  • Deployment process is triggered automatically each time I commit something to master branch;

To allow deployment script push build_production to remote gh-pages branch, you need to go to your Github Settings → Personal Access Tokens and create a new token. Then you need to add this token to repository's Secrets. Then, you can access that token in deployment script as variable stored under secrets keyword, for example: ${{secrets.DEPLOY_KEY}}

Feel free to modify this deployment script as needed.

© 2023 [maxico.dev] — All rights reserved.