Skip to content

Commit

Permalink
test publishing package sites to Github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Dec 4, 2024
1 parent a965b75 commit 5883b00
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
path: gh-pages
ref: gh-pages

- name: Publish documentation
- name: Publish book
if: runner.os == 'macOS'
run: |
Rscript -e 'install.packages("xfun", repos="https://yihui.r-universe.dev")'
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Render package site and deploy to Github Pages

on:
push:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- uses: r-lib/actions/setup-r@HEAD
- uses: r-lib/actions/setup-r-dependencies@HEAD
- uses: yihui/litedown/site@HEAD
- uses: actions/upload-pages-artifact@v3
with:
path: 'site'
- id: deployment
uses: actions/deploy-pages@v4
4 changes: 3 additions & 1 deletion site/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ runs:
using: "composite"
steps:
- name: Install R packages
shell: bash
run: |
Rscript -e "install.packages(c('litedown', 'xfun'), repos = 'https://yihui.r-universe.dev')"
R CMD INSTALL "${{ inputs.pkg-root }}"
Rscript -e "if (!requireNamespace('litedown')) install.packages('litedown')"
- name: Build site
shell: bash
run: |
cd "${{ inputs.pkg-root }}"
mkdir -p "${{ inputs.site-dir }}"
Expand Down

0 comments on commit 5883b00

Please sign in to comment.