Collaborative {distill} website workflows
Note: This post was originally written by Shannon Pileggi and was copied here on April 04, 2021 - see the original post here for a potentially updated version.
If you are deploying your {distill} website through Netlifly, you can enable deploy previews to create temporary urls to preview a branch.
My usual website workflow so far has been to draft posts in my master branch with draft: true
in the yaml
, and then when I am ready to publish switch to draft: false
and commit to my main/master branch. Recently, I’ve been inspired to try alternative workflows:
I’m also a huge convert to the church of making PRs to yourself. Start with an R Markdown project like a simple slide deck or a bookdown book, then get into the habit of every change is a branch + PR. Low cost, but teaches you a lot! pic.twitter.com/Ee3tuoS4Ef
— Alison Presmanes Hill (@apreshill) February 20, 2021
I also collaborated with someone on a blog post for the first time, and I learned that you can send links to preview branches! 🎉 For both solo and collaborative posts, this is my new workflow.
I did a quick search for existing guides, and I found that Garrick Aden‑Buie has a comprehensive 2019 blog post titled A Blogdown New Post Workflow with Github and Netlify. Some of the steps are specific to {blogdown}, so here is my {distill} take on it.
First, make sure you have deploy previews enabled on Netlifly. Login to Netlifly, go to your site, and then:
➡️ Site settings
➡️ Build & deploy
➡️ Deploy contexts
➡️ Deploy previews
➡️ Select Any pull request against your production branch / branch deploy branches Netlify will generate a deploy preview with a unique URL for each built pull request.
netlifly-deploy-branch
, and in the R console submit:usethis::pr_init("netlifly-deploy-branch")
distill::create_post("Deploy previews with Netlifly")
Draft post; set draft: false
in the yaml
.
Knit post. Depending on what you are doing in your branch, you may also need to 🔨 Build Website
.
Commit everything. In terminal submit:
usethis::pr_push()
In GitHub, click “Create pull request”.
Some automatic checks will run. Click on “Details” where it says “Deploy preview ready!”
This opens up a window in my browser with the url https://deploy-preview-3--flamboyant-mccarthy-854a9b.netlify.app/
. Send this link to a friend for review!
Edit draft, repeat steps 4-8.
When ready to publish, back in GitHub click on “Merge pull request”.
Added April 3, 2020:
Maëlle Salmon recommends “Squash and merge” from the drop down menu to create a cleaner commit history.
She also recommends deleting branches after merging and provided this link to Refined GitHub, a “browser extension that simplifies the GitHub interface and adds useful features.” 😄
I’m new to this workflow and this post was written quickly - edits and suggestions are welcome!
Thanks, Alison Hill!🤗
Also, thanks for the additional recommendations, Maëlle Salmon!
If you see mistakes or want to suggest changes, please create an issue on the source repository.
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at https://github.com/jhelvy/distillery, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Pileggi (2021, April 1). The Distillery: Deploy previews with Netlifly. Retrieved from https://distillery.rbind.io/posts/2021-04-01-deploy-previews-with-netlifly/
BibTeX citation
@misc{pileggi2021deploy, author = {Pileggi, Shannon}, title = {The Distillery: Deploy previews with Netlifly}, url = {https://distillery.rbind.io/posts/2021-04-01-deploy-previews-with-netlifly/}, year = {2021} }