Skip to content

Commit

Permalink
Add a pkgdown documentation site (#78)
Browse files Browse the repository at this point in the history
You will need to tell GitHub to use the `gh-pages` and the `\` dir to deploy the site (I don't have permission to do that).

Other than that it should just automatically build and deploy the documentation to https://public-health-scotland.github.io/phstemplates/ whenever you add something to main.
  • Loading branch information
Moohan authored Jan 10, 2024
1 parent de7891b commit 0082899
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
^\.github$

^LICENSE\.md$
^_pkgdown\.yml$
^docs$
^pkgdown$
48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

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@v3

- 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/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ data/
# MacOS folder attributes files #
.DS_Store

docs
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ Authors@R: c(
person("James", "McMahon", , "[email protected]", role = "ctb",
comment = c(ORCID = "0000-0002-5380-2029")),
person("Ellie", "Bates", , "[email protected]", role = "ctb")
)
)
Description: Templates for Public Health Scotland.
License: MIT + file LICENSE
URL: https://github.com/Public-Health-Scotland/phstemplates
URL: https://github.com/Public-Health-Scotland/phstemplates,
https://public-health-scotland.github.io/phstemplates/
BugReports: https://github.com/Public-Health-Scotland/phstemplates/issues
Depends:
R (>= 3.2.0)
Expand Down
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
url: https://public-health-scotland.github.io/phstemplates/
template:
bootstrap: 5

0 comments on commit 0082899

Please sign in to comment.