Publish a Quarto Document with R to Connect Cloud

Skip the tutorial and publish the example now

This guide builds a Quarto document using R and deploys it to Posit Connect Cloud. Code for the project is available on GitHub.

1. Create a new GitHub repository

Sign in to GitHub and create a new, public repository.

2. Start a new RStudio project

In RStudio:

  1. Click New Project from the File menu
  2. Select Version Control
  3. Select Git
  4. Paste the URL to your repository in the Repository URL field
  5. Enter a Desired Project directory name
  6. Confirm or change the subdirectory location

Now that your project is synced with your GitHub repository, you are ready to begin coding.

From the New File dropdown or the New File option from the File menu:

  1. Select Quarto Document
  2. Uncheck the Use visual markdown editor checkbox
  3. Click Create Empty Document
  4. Save the file as report.qmd

Build the document

Replace the content in report.qmd with the code in this file.

Preview the document

In RStudio when looking at report.qmd, click the Render button. Depending on your Format Options, you will see a local preview of the document either in the Viewer pane or a new browser tab.

Add dependency file

The last thing you need to do is create a dependency file that will provide Connect Cloud with enough information to rebuild your content during deployment. Although there are multiple approaches to achieve this, Connect Cloud exclusively uses a manifest.json file.

To create this file, load the rsconnect library and run the writeManifest() function.

rsconnect::writeManifest()

This function creates a .json file named manifest.json that will tell Connect Cloud (1) what version of R to use and (2) what packages and versions are required.

3. Push to GitHub

Now that everything looks good and we’ve created a file to help reproduce your local environment, it is time to get the code on GitHub.

  1. Navigate to the Git tab in your RStudio project
  2. Click Commit
  3. Select the checkbox to stage each new or revised file
  4. Enter a commit message
  5. Click Commit
  6. Click the Push icon

Your repository now has everything it needs for Connect Cloud.

4. Deploy to Posit Connect Cloud

Follow the steps below to deploy your project to Connect Cloud.

  1. Sign in to Connect Cloud.

  2. Click the Publish icon button on the top of your Portfolio page

  3. Select Quarto

  4. Select the public repository that you created in this tutorial

  5. Confirm the branch

  6. Select report.qmd as the primary file

  7. Click Publish

Publishing will display status updates during the deployment process. You will also find build logs streaming on the lower part of the screen.

Congratulations! You successfully deployed to Connect Cloud and are now able to share the link with others.

5. Republish the application

If you update the code to your application or the underlying data source, commit and push the changes to your GitHub repository.

Once the repository has the updated code, you can republish the application on Connect Cloud by going to your Content List and clicking the republish icon.