From fc41e428dd87278b0dcc812d04a5d4accb87faf8 Mon Sep 17 00:00:00 2001 From: Kari Lavikka Date: Tue, 14 Jan 2025 16:05:19 +0200 Subject: [PATCH] use pkgdown --- .Rbuildignore | 4 ++ .github/.gitignore | 1 + .../workflows/build-and-deploy-vignette.yaml | 63 ------------------- .github/workflows/pkgdown.yaml | 49 +++++++++++++++ .gitignore | 1 + DESCRIPTION | 2 +- _pkgdown.yml | 4 ++ 7 files changed, 60 insertions(+), 64 deletions(-) create mode 100644 .github/.gitignore delete mode 100644 .github/workflows/build-and-deploy-vignette.yaml create mode 100644 .github/workflows/pkgdown.yaml create mode 100644 _pkgdown.yml diff --git a/.Rbuildignore b/.Rbuildignore index 8a7427f..6831fbe 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,7 @@ ^tools$ ^doc$ ^Meta$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ +^\.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/build-and-deploy-vignette.yaml b/.github/workflows/build-and-deploy-vignette.yaml deleted file mode 100644 index 05cd186..0000000 --- a/.github/workflows/build-and-deploy-vignette.yaml +++ /dev/null @@ -1,63 +0,0 @@ -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 'Jellyfisher Vignettes

Jellyfisher Vignettes

' > 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 diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..bfc9f4d --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,49 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + release: + types: [published] + workflow_dispatch: + +name: pkgdown.yaml + +permissions: read-all + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - 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 + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index 1acbc91..0c58085 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ inst/doc /doc/ /Meta/ +docs diff --git a/DESCRIPTION b/DESCRIPTION index f8c84db..51a9852 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,7 +13,7 @@ Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 LazyData: true -URL: https://github.com/HautaniemiLab/jellyfisher +URL: https://github.com/HautaniemiLab/jellyfisher, https://hautaniemilab.github.io/jellyfisher/ BugReports: https://github.com/HautaniemiLab/jellyfisher/issues Suggests: clonevol, diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..b28c988 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,4 @@ +url: https://hautaniemilab.github.io/jellyfisher/ +template: + bootstrap: 5 +