From cd5a9cd6ccb953965287fed189bb2fc840634a88 Mon Sep 17 00:00:00 2001 From: Adam Blake Date: Thu, 9 Nov 2023 23:19:21 -0800 Subject: [PATCH] ci: deploy webr repository on github pages --- .github/workflows/build-wasm.yaml | 4 ++- .github/workflows/deploy-wasm.yaml | 50 ++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-wasm.yaml diff --git a/.github/workflows/build-wasm.yaml b/.github/workflows/build-wasm.yaml index 055f578..9616c73 100644 --- a/.github/workflows/build-wasm.yaml +++ b/.github/workflows/build-wasm.yaml @@ -6,7 +6,6 @@ on: - ".vscode/**" - "bin/**" branches: - - main - release/* - hotfix/* pull_request: @@ -28,6 +27,9 @@ jobs: runs-on: ubuntu-latest container: ghcr.io/r-wasm/webr:main steps: + # https://github.com/actions/checkout - uses: actions/checkout@v3 + + # https://github.com/r-wasm/actions - name: Build wasm packages uses: r-wasm/actions/build-wasm-packages@v1 diff --git a/.github/workflows/deploy-wasm.yaml b/.github/workflows/deploy-wasm.yaml new file mode 100644 index 0000000..8fb5d3c --- /dev/null +++ b/.github/workflows/deploy-wasm.yaml @@ -0,0 +1,50 @@ +on: + push: + branches: [main] + workflow_dispatch: + +name: Build WASM R package repository + +jobs: + build: + runs-on: ubuntu-latest + container: ghcr.io/r-wasm/webr:main + steps: + # https://github.com/actions/checkout + - uses: actions/checkout@v3 + + # https://github.com/r-wasm/actions + - name: Build wasm packages + uses: r-wasm/actions/build-wasm-packages@v1 + with: + strip: c("demo", "doc", "examples", "help", "html", "include", "tests", "vignette") + + deploy: + name: Deploy to GitHub pages + needs: build + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + # https://github.com/actions/checkout + - uses: actions/checkout@v3 + + # https://github.com/r-wasm/actions + - name: Download wasm artifacts + uses: r-wasm/actions/download-wasm-artifacts@v1 + with: + repo-path: _site + image-path: _site + + # https://github.com/actions/upload-pages-artifact + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v2 + + # https://github.com/actions/deploy-pages + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2