How it worksCase studiesSustainability
Get started for free

Fast GitHub Actions deployments for emergencies

Posted on under Engineering

We use Sapper and Svelte for the Pabio's old website, and we have a pretty comprehensive CI/CD build process. The process includes running unit tests, Cypress end-to-end tests, Lighthouse audits, Semantic Release versioning, and finally exporting a static version of the site which is then published.

This, however, means that the entire CI flow from commit push to deployment takes between 3 and 4.5 minutes, which might be too late for emergency deployments for important bug fixes. For this, we made a “fast” deployment process that skips all tests and just exports, purges, and deploys. This takes less than a minute, but of course is dangerous and should only be used in exceptional circumstances (luckily, we haven’t had the need for this yet).

For the Fast Deploy GitHub Actions workflow, we make sure that the last commit message includes the text [fast], just like you’d check for the text [skip ci] to skip the process altogether. This is a separate workflow that only runs when the [fast] flag is present in a commit, so it’s skipped in almost all pushes.

In this workflow, we only checkout the repository, install Node.js and then the dependencies, and build the static site. Then, we push it to the gh-pages branch and deploy that branch on our CDN, while force-purging its cache to make sure all users will see the most recent version.

Of course, this is not recommended for day-to-day use and only for those specific emergencies when you need to push your code really quickly.

About the authors

Anand Chowdhary

Co-founder & CTO

Anand is a creative technologist and entrepreneur who has been featured in Forbes 30 Under 30. Anand is also an avid open-source contributor, GitHub Star, non-profit advisor, and consultant to startups. He splits his time between living in Groningen, the Netherlands, and New Delhi, India.