Skip to content

Commit 0ff27a2

Browse files
authored
fix(ci): build the wasm image directly instead of via the r-wasm reusable workflow (#319)
release-file-system-image.yml leaves `remotes = NA` in `rwasm::add_pkg()`, which resolves rwasm's built-in list of webR package forks from GitHub with no PAT. That resolution fails here, surfacing as an opaque `res_one_row_df(): nrow(out) must equal 1` from the container's older pkgdepends. We build only shinyreact, so `remotes = NULL` skips it. Refs #268
1 parent 7b672bd commit 0ff27a2

1 file changed

Lines changed: 47 additions & 11 deletions

File tree

‎.github/workflows/release-r-wasm.yaml‎

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ name: release-r-wasm
33
# Attaches WebAssembly assets (`library.data.gz` + `library.js.metadata`) to an
44
# `r/v*` GitHub release, so shinylive can install the R package from GitHub.
55
#
6-
# shinylive:::get_github_wasm_assets() looks up
7-
# /repos/posit-dev/shinyreact/releases/tags/<RemoteRef> and expects those two
6+
# shinylive:::get_github_wasm_assets() is the only path shinylive has for a
7+
# GitHub-installed R package: it looks up
8+
# /repos/posit-dev/shinyreact/releases/tags/<RemoteRef> and wants those two
89
# assets, where <RemoteRef> is whatever ref the user installed:
910
#
1011
# pak::pak("posit-dev/shinyreact/pkg-r@r/v0.1.0") # RemoteRef: "r/v0.1.0"
@@ -17,6 +18,17 @@ name: release-r-wasm
1718
#
1819
# `release` events only run workflows from the default branch, so this file must
1920
# be on main before the release is created.
21+
#
22+
# This drives the webR container directly instead of using
23+
# r-wasm/actions/.github/workflows/release-file-system-image.yml, for one
24+
# reason: that workflow's `rwasm::add_pkg()` call leaves `remotes = NA`, which
25+
# resolves rwasm's built-in list of webR package forks (`r-wasm/shiny@webr` and
26+
# friends) from GitHub with no PAT. In this repo that resolution fails, and an
27+
# older pkgdepends in the container reports it as an opaque
28+
# `res_one_row_df(): nrow(out) must equal 1`. We build only shinyreact
29+
# (`dependencies = FALSE`, matching the reusable workflow), so the fork
30+
# preferences are irrelevant here and `remotes = NULL` skips them. shinyreact's
31+
# own dependencies come from repo.r-wasm.org at runtime.
2032

2133
on:
2234
release:
@@ -25,13 +37,37 @@ on:
2537
jobs:
2638
wasm:
2739
if: startsWith(github.event.release.tag_name, 'r/v')
40+
runs-on: ubuntu-24.04
2841
permissions:
29-
contents: write
30-
repository-projects: read
31-
uses: r-wasm/actions/.github/workflows/release-file-system-image.yml@v3
32-
with:
33-
packages: local::./pkg-r
34-
strip: "demo, doc, examples, help, html, include, tests, vignette"
35-
# Pin to the webR release shinylive ships (0.6.0 / R 4.6.0). A wasm binary
36-
# built against a different R version won't load.
37-
webr-image: ghcr.io/r-wasm/webr:v0.6.0
42+
contents: write # upload assets to the release
43+
44+
steps:
45+
- uses: actions/checkout@v6
46+
47+
- name: 🧱 Build the webR filesystem image
48+
run: |
49+
cat > build-wasm.R <<'EOF'
50+
setwd("/github/workspace")
51+
rwasm::add_pkg("local::./pkg-r", repo_dir = "_site", remotes = NULL)
52+
rwasm::make_vfs_library(
53+
out_dir = "_rwasm",
54+
repo_dir = "_site",
55+
compress = TRUE,
56+
strip = c("demo", "doc", "examples", "help", "html", "include", "tests", "vignette")
57+
)
58+
# compress = TRUE also leaves the uncompressed image behind; drop it
59+
# so only library.data.gz is uploaded.
60+
unlink(list.files("_rwasm", pattern = "\\.data$", full.names = TRUE))
61+
EOF
62+
# Pinned to the webR release shinylive ships (0.6.0 / R 4.6.0). A wasm
63+
# binary built against a different R version won't load.
64+
docker run --rm \
65+
-v "$PWD":/github/workspace --workdir /github/workspace \
66+
--entrypoint Rscript ghcr.io/r-wasm/webr:v0.6.0 \
67+
/github/workspace/build-wasm.R
68+
ls -l _rwasm
69+
70+
- name: 📦 Upload the assets to the release
71+
env:
72+
GH_TOKEN: ${{ github.token }}
73+
run: gh release upload "$GITHUB_REF_NAME" _rwasm/* --clobber

0 commit comments

Comments
 (0)