Update release-wasm workflow for improved image build #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Workflow for building and uploading a WebAssembly R package image to a GitHub Release | ||
|
Check failure on line 1 in .github/workflows/release-wasm.yaml
|
||
| # Adapted from: https://github.com/r-wasm/actions/blob/main/.github/workflows/release-file-system-image.yml | ||
| name: Build and release WebAssembly image | ||
| on: | ||
| # Trigger this workflow when you publish a new GitHub Release | ||
| release: | ||
| types: [published] | ||
| # Allow manual triggering from the Actions tab for testing | ||
| workflow_dispatch: | ||
| inputs: | ||
| packages: | ||
| description: 'R packages to include (space or comma separated). Defaults to "." (current package)' | ||
| required: false | ||
| default: '.' | ||
| type: string | ||
| strip: | ||
| description: 'Directories to strip from the image (e.g., "demo, doc, examples"). Use "NULL" for none.' | ||
| required: false | ||
| default: 'demo, man, pkgdown, tests, vignettes, doc, examples, help, html' | ||
| type: string | ||
| webr-image: | ||
| description: 'webR Docker image to use for building' | ||
| required: false | ||
| default: 'ghcr.io/r-wasm/webr:main' | ||
| type: string | ||
| compress: | ||
| description: 'Compress the Emscripten VFS image' | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| # Allow only one concurrent build for a given release tag | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.release.tag_name || github.run_id }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| build-and-upload: | ||
| runs-on: ubuntu-24-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: r-lib/actions/setup-r@v2 | ||
| with: | ||
| r-version: '4.4.0' | ||
| - name: Install rwasm | ||
| shell: Rscript {0} | ||
| run: | | ||
| install.packages("rwasm", repos = "https://cloud.r-project.org") | ||
| - uses: actions/checkout@v4 | ||
| - name: Build current package | ||
| shell: Rscript {0} | ||
| run: | | ||
| library(rwasm) | ||
| dir.create("._rwasm_image", showWarnings = FALSE) | ||
| make_library( | ||
| packages = ".", | ||
| strip = c("demo", "doc", "examples", "help", "html", "tests", "vignette"), | ||
| output = "._rwasm_image" | ||
| ) | ||
| - name: Upload | ||
| uses: svenstaro/upload-release-action@v2 | ||
| with: | ||
| repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
| file: '._rwasm_image/*' | ||
| tag: ${{ github.event.release.tag_name || github.ref_name }} | ||
| file_glob: true | ||
| overwrite: true | ||
| file: '._rwasm_image/*' # Path to the generated image files | ||
| tag: ${{ github.event.release.tag_name || github.ref_name }} | ||
| file_glob: true | ||
| overwrite: true | ||