diff --git a/examples/rwasm-binary-and-pkgdown-site.yml b/examples/rwasm-binary-and-pkgdown-site.yml new file mode 100644 index 0000000..ccb0b36 --- /dev/null +++ b/examples/rwasm-binary-and-pkgdown-site.yml @@ -0,0 +1,68 @@ +# Workflow derived from https://github.com/r-wasm/actions/tree/v1/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +name: R Wasm & pkgdown deploy + +jobs: + build-site: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Usual steps for generating a pkgdown website + - uses: r-lib/actions/setup-pandoc@v2 + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + # Change the build directory to `_site` + - name: Build site + shell: Rscript {0} + run: | + pkgdown::build_site_github_pages( + new_process = FALSE, + install = FALSE, + dest_dir = "_site" + ) + + # Build the local R package and structure the CRAN repository + - name: Build Wasm R packages + uses: r-wasm/actions/build-rwasm@v1 + with: + packages: "." + repo-path: "_site" + + # Upload an artifact that will work with GitHub Pages + - name: Upload Pages artifact + if: github.event_name != 'pull_request' + uses: actions/upload-pages-artifact@v3 + with: + path: "_site" + + deploy: + if: github.event_name != 'pull_request' + needs: [build-site] + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4