Cloud

fw publish

publish

Publish an artifact to Framework Cloud

Added in 0.2.0.

Uploads a plot, table, file, or rendered HTML document to the current project on Framework Cloud, as R's publish() does. It uses the project token in .env, so run fw project link first.

PATH is a file or a folder of rendered HTML output. When analysis.html has an analysis_files/ folder next to it, both are sent. A folder is sent whole, opening at --entrypoint (default index.html).

Every artifact gets an unlisted link. --readable also gives it a readable address under your handle, and --readable=false takes that away. Publishing to the same slug again adds a new version.

--to github publishes to the project's GitHub Pages site instead. fw copies the document to published/SLUG/ in the repository, commits only that folder, and pushes; the workflow Framework Cloud added to the repository deploys it. GitHub Pages sites are public, even from a private repository. Turn Pages on for the project under Projects on Framework Cloud first.

fw sends only what PATH names, and only when you run it. It shows what it will send and asks first; --yes skips the question. When a file's full path contains "private", fw warns and asks again. With --yes, --json, or no terminal, such an upload stops with exit code 6 unless you pass --include-private.

Usage

fw publish PATH [flags]

Options

Name Type Default Description
PATH required string

An .html file, or a folder of rendered output.

--collection string

existing project collection ID or slug

--description string

the artifact description

--entrypoint string

with a folder: the HTML file to open (default index.html)

--include-private bool

upload files whose path contains "private" without asking

--json bool

print JSON on stdout, for scripts and agents

--kind string

artifact kind: html, image, table, model, text, pdf, or file (default detected)

--password string

password required to view the artifact

--readable bool

give the document a readable address; --readable=false removes it

--share-unlisted bool

allow collection readers to access this unlisted artifact

--slug string

the document's name in the project (default: from the file name)

--title string

the document's title

--to string "cloud"

where to publish: cloud (Framework Cloud) or github (the project's GitHub Pages site)

--url string

Framework Cloud server (default: the project's FW_CLOUD_URL)

Environment variable: FW_CLOUD_URL

--visibility string

artifact visibility: public or unlisted

-y, --yes bool

upload without asking

Value

With --json, the document: slug, version, url (the link to share), private_url, readable_url, version_url, raw_url, and notice. With --to github, url, commit (null when nothing changed), pushed, and pages_enabled (null when the project is not linked, or fw could not reach Framework Cloud).

Exit codes

Code Meaning
0 Success
1 Failure
2 Bad flags or arguments
3 Not logged in, or the server rejected the token
4 The server has no such project or resource
5 Browser login was denied, or its code expired
6 An upload has "private" in a path; rerun with --include-private if you mean to send it

With --json, a failure also prints one JSON line on stderr: {"error": "...", "exit_code": 4}. Exit code 6 adds "reason": "private_path".

Examples

Not run

fw publish notebooks/analysis.html
fw publish outputs/reports/summary.html --slug summary --readable --yes
fw publish _site --entrypoint index.html --json --yes
fw publish outputs/notebooks/results.html --to github --slug results

Related reference