Skip to content

Commit

Permalink
Add further documentation about GHA and CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg committed Dec 15, 2023
1 parent 333dbed commit adaf67d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vignettes/github-actions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ usethis::use_github_action(
)
```

Commit the new GitHub Actions file, then make a release through the GitHub web interface. GitHub Actions will build a Wasm filesystem image for your package and its dependencies and upload it as an asset file for that specific package release.
Commit the new GitHub Actions file, then make a release through the GitHub web interface. GitHub Actions will build a Wasm filesystem image for your package and its dependencies and upload it as asset files for that specific package release.

Once the Github Action has finished, copy the link to the `library.data` asset file from the GitHub releases page. Then, in webR, mount the filesystem image and set the `.libPaths()` to load a package from the package library:
Once the Github Action has finished, the `library.data` and `library.js.metadata` assets files can be downloaded from the GitHub releases page. The filesystem image files should then be made available through static hosting in some way, for example though further GitHub Actions steps to upload the filesystem image files as part of a custom GitHub Pages website.^[In principle, it is possible to directly mount the filesystem image from the release asset URL using `webr::mount()`. However, in web browsers this will likely be blocked due to the [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) mechanism.]

Finally, in webR, mount the statically hosted filesystem image and set the `.libPaths()` to load a package from the package library:

```{r eval=FALSE}
webr::mount("/my-library", "https://github.com/org/repo/releases/download/v0.0.0/library.data")
webr::mount("/my-library", "https://org.github.io/repo/download/library.data")
.libPaths(c(.libPaths(), "/my-library"))
library(dplyr)
#> Attaching package: ‘dplyr’
Expand Down

0 comments on commit adaf67d

Please sign in to comment.