Cloudflare's Preview Deployments is nice
In my previous post, I wrote about my workflow to update this site. I wrote about how I can changes on a branch and then merge to main - so that they're deployed automatically by Cloudflare. But, what if you what to review (or test) your changes before merging to main, before they're visible to the world?
That's where Cloudflare's Preview Deployments come in.
So, once we have some changes on a branch, as a good practice, we should create a PR for it. I then get this, for this post, as an example:
Cloudflare deploys the changes for you. The Preview URL
changes everytime a deployment occurs, it's a hash, random or of something. Not the same as the git commit hash. The Branch Preview URL
is always the same and for the latest deployment of the PR. So, I can go straight there to review. I can also go to the deployment logs if there's any problem. (Since I've integrated with CodeSandbox too, there are some nice links I can write about some other time.) The deployment takes some time, few tens of seconds. So, it's not ideal for a quick code-test cycle.
It's worth noting that these preview links will continue to work, long after the merge is done. The deployments don't seem to be automatically removed by Cloudflare, which is annoying. I have to go to the dashboard to manually remove them. May be I just haven't found a setting that does this automatically (after a period of time or after PR merges), or may be I should raise a feature request with Cloudflare.