This action may be use for publishing to RStudio Connect.
Important Note: The only currently supported type of publishing is "from manifest". This type of publishing requires that a
manifest.json
has already been generated by either the R or Pythonrsconnect
package, which may be done within an earlier GitHub Actions step or performed locally and stored in git.
R users may find it easiest to set up scaffolding for GitHub Actions using the usethis
package.
You can import and use this GitHub Action in your project using
usethis::use_github_action(url = "https://raw.githubusercontent.com/rstudio/actions/main/examples/connect-publish.yaml")
Once imported, you can adjust the settings below to match your use case.
Required RStudio Connect URL of the instance to which content
will be published. The value of the URL may contain an API key
genereted in RStudio
Connect
(equivalent to the api-key
input) in the "user" or "password"
part.
Directory or directories containing the content to publish,
optionally with :<app-identifier>
suffixes, separated by
newlines. Without a :<app-identifier>
suffix, the value of the
directory path will be used to match any existing published
content. (Default "."
)
NOTE The
:<app-identifier>
may be one of the following:
- GUID, e.g.
ffffffff-aaaa-ffff-aaaa-ffffffffffff
, which is used when the string is a valid GUID- name, e.g.
name-without-slashes
, which is tried when the string does not contain at least one slash- vanity URL (path), e.g.
/name-with/a-slash
, which is tried when the string does contain at least one slash
Directory relative to which the 'dir' argument(s) will be resolved. (Default "."
).
An API key genereted in RStudio
Connect.
This value may be included in url
as the "user" or "password"
part. (No default)
Access type to apply to published content. (No default)
Valid values are:
all
publicly accessiblelogged_in
accessible only when logged into RStudio Connectacl
accessible to specific users and groups (managed within RStudio Connect)
When not specified, the RStudio Connect server configuration default applies. Access types disallowed by RStudio Connect server configuration will result in the publish being canceled.
Namespace prefix for published paths. (No default)
This value is used in the construction of the "vanity URL" path, e.g. this configuration:
- uses: rstudio/actions/connect-publish@main
with:
url: https://${{ secrets.RSTUDIO_CONNECT_API_KEY }}@connect.example.org
namespace: experimental-beta
dir: ./very-shiny-app/:/shiny/app/path/
will result in a published URL of
https://connect.example.org/experimental-beta/shiny/app/path/
NOTE Because the namespace is used as the first segment of a slash-delimited path, there are restrictions on what is allowed by RStudio Connect. For example, a namespace of
connect
is not allowed and will result in an error at publish time.
Show all publishing logs. (Default false
)
Force publish even if up to date. (Default false
)
NOTE: The determination of a given publish being up to date is based on the bundle generated from the manifest matching the current bundle according to RStudio Connect. If available, the bundle SHA1 digest is compared, else the bundle size is compared.
Require setting the vanity path. (Default false
)
A given RStudio Connect server may be configured such that an
application's vanity path may not be set by users with the
publisher
role. The default behavior will attempt to set the
vanity path and any failure to do so will be logged in the debug
logs. By setting require-vanity-path: true
, any failure to set
the vanity path will bubble up as an error and cancel publishing.
Update content environment variables. (Default true
)
The environment variables configured for published content may be configured via the running process environment and via a specific set of files relative to the content directory.
Any environment variable in the process environment that begins
with the prefix CONNECT_ENV_SET_
will be set without the prefix,
e.g.:
# ...
steps:
- name: Publish some things
uses: rstudio/actions/connect-publish@main
env:
CONNECT_ENV_SET_MYVAR: available at runtime
with:
url: https://${{ secrets.RSTUDIO_CONNECT_API_KEY }}@connect.example.org
access-type: logged_in
dir: |
./flask-api/
will result in the following variable being configured on the published content:
MYVAR='available at runtime'
The first of the following files that is found will be read:
.rstudio-connect.env
rstudio-connect.env
rsconnect/env
rsconnect-python/env
The content of the file is expected to be shell-like with variables defined, and may contain comments, e.g.:
# the following variable is available at runtime
SECRET_INGREDIENT='tartlet'
# referencing the variable name without an assignment will read the
# variable from the process environment
MYVAR
# variables with leading "export" or "set" work, too
export FRIENDS="great"
set PASTA='usually awesome'
JSON-serialized array of objects, each containing a dir
, url
,
id
, and success
key indicating per-directory publish success.
In case of an unhandled error, the value will be an empty array.
steps:
- uses: actions/checkout@v2
- name: Publish some things
uses: rstudio/actions/connect-publish@main
with:
url: https://${{ secrets.RSTUDIO_CONNECT_API_KEY }}@connect.example.org
access-type: logged_in
dir: |
./very-shiny-app/:/shiny/app/path/
./useful-rmarkdown-report/:useful-report-for-cats
./slick-flask-api/
./insightful-jupyter-notebook/:528f3dc0-3bd0-41e6-a191-aa264c451416