Publishing

The following documentation is an overview of “Push-button Deployment” in RStudio.

For full documentation on options for specific platforms:

Push-button deployment

The blue publishing icon in RStudio indicates built-in support for publishing the currently selected type of content to Posit Connect, Posit Cloud, Shinyapps.io, or RPubs.com.

The RStudio publishing icon

The RStudio publishing icon

The blue publishing icon is present in the following locations:

  • The upper right of the file editor

  • The document Viewer pane when viewing a document

  • The embedded Viewer when running a Shiny application

  • The Plots pane

Click the blue publishing icon to open a publishing dialog where you can name your content and select additional files to include in the deployment. By default, RStudio will try to infer the data files and scripts that are used in your content. This window lets you refine those file selections.

RStudio publishing dialog for a Quarto document

Typically, RStudio is able to determine automatically which files are needed to render your document on the remote server. However, there are situations in which it will miss a file (for instance, if it isn’t referenced directly in your document). The Add More... button lets you add files to the bundle, so that they will be available on the server when your document is rendered. You can also use the resource_files field in the document’s YAML header to add additional files.

Deployed data files must be in the same directory as the Shiny application or R Markdown/Quarto document, or in a subdirectory of that location. Files stored elsewhere on the computer will not be available on the remote server and cannot be included in the content bundle.

Click Publish after verifying the settings.

Publishing documents

You can publish R Markdown (.Rmd) and Quarto (.qmd) documents to Posit Connect, Posit Cloud, or RPubs.com.

Publish to RPubs or Connect

Publish to RPubs, Posit Connect, or Posit Cloud

RPubs is a service for easily sharing public R Markdown documents. RPubs is not related to Posit Connect, and you should always choose “Posit Connect” if you wish to publish your content to Posit Connect.

Publishing Shiny apps

You can publish Shiny apps to Posit Connect, Posit Cloud, or shinyapps.io.

Connect account in RStudio

Including secrets

Posit Connect supports including secrets and other sensitive information as Vars (Environment Variables). When developing content for Connect, you should never place secrets (keys, tokens, passwords, etc.) in the code itself.

RStudio also supports the inclusion of environment variables defined in the user/project .Renviron file when publishing content to Posit Connect.

Screenshot of including environment variables when publishing from RStudio.

One or more environment variables can be selected for inclusion on Posit Connect. On publish, environment variables are sent over an encrypted connection and are not stored in the bundle. Environment variables are set prior to deployment so that your code can use them and the first deployment can still succeed. This means that if the deployment fails, the values will still be updated.

Reference the Posit Connect User Guide section on Vars (Environment Variables) for more information. The rsconnect R package can also include environment variables when publishing programatically. For more information, reference the [rsconnect documentation for envVars](https://rstudio.github.io/rsconnect/reference/deployApp.html#arg-envvars)

Additional content

For additional details or other content types, refer to the product-specific documentation:

Back to top