From 8b3a9098d42f90cff5fc0c347b88f863a0e64196 Mon Sep 17 00:00:00 2001 From: Pierre Chelle <45343665+pchelle@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:22:14 -0400 Subject: [PATCH] Fixes #1 build website (#9) * Fixes #1 build website * Do not install addins --- .Rbuildignore | 1 + .github/.gitignore | 1 + .github/workflows/update-website.yml | 42 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .github/.gitignore create mode 100644 .github/workflows/update-website.yml diff --git a/.Rbuildignore b/.Rbuildignore index 600f12b..6ba4839 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,4 @@ ^LICENSE\.md$ ^README\.Rmd$ ^cran-comments\.md$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/update-website.yml b/.github/workflows/update-website.yml new file mode 100644 index 0000000..0985fa1 --- /dev/null +++ b/.github/workflows/update-website.yml @@ -0,0 +1,42 @@ +name: Update website +on: + push: + branches: + - main + +# The action needs permissions to update the branch +permissions: + contents: write +env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + +jobs: + update-website: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + # No need to install ospsuite ecosystem + # because the job only needs to display the md reports as html pages + - name: Packages to build website + run: install.packages(c("rmarkdown", "pkgdown")) + shell: Rscript {0} + # The script temporarily create index and vignettes for pkgdown to build site + - name: Build pkgdown website + run: pkgdown::build_site(install = FALSE) + shell: Rscript {0} + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + # The deployment folder should match the name of the artifact. + # Clean is false to prevent removing release site + # only target folder of repo from gh-pages branch is updated + with: + folder: docs + clean: true + branch: gh-pages + target-folder: docs + token: ${{ secrets.GITHUB_TOKEN }}