Skip to content

update action

update action #3

name: Build and Deploy Vignette
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Cache apt dependencies
uses: actions/cache@v3
with:
path: /var/lib/apt/lists
key: ${{ runner.os }}-apt
restore-keys: |
${{ runner.os }}-apt
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Cache R packages
uses: actions/cache@v3
with:
path: ~/.R/library
key: ${{ runner.os }}-r-${{ hashFiles('**/DESCRIPTION', '**/NAMESPACE') }}
restore-keys: |
${{ runner.os }}-r-
- name: Install dependencies
run: |
Rscript -e 'install.packages("devtools")'
Rscript -e 'devtools::install_deps(dependencies = TRUE)'
- name: Install the jellyfisher package
run: |
R CMD INSTALL .
- name: Build vignette
run: |
Rscript -e 'rmarkdown::render("vignettes/introduction.Rmd", output_file = "docs/introduction.html")'
echo '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Jellyfisher Vignettes</title></head><body><h1>Jellyfisher Vignettes</h1><ul><li><a href="docs/introduction.html">Introduction</a></li></ul></body></html>' > docs/index.html
deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Deploy to gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
publish_branch: gh-pages