Skip to content

Commit 8236db8

Browse files
authored
Add GH action for pkgdown build (#102)
* Add GH action for pkgdown build * add grass install and demo location download to pkgdown build * Minor changes when building site
1 parent 5ddd5d6 commit 8236db8

File tree

4 files changed

+69
-1
lines changed

4 files changed

+69
-1
lines changed

.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ _pkgdown.yml
66
^\.Rproj\.user$
77
^\.github$
88
^codecov\.yml$
9+
^_pkgdown\.yml$
10+
^docs$
11+
^pkgdown$

.github/workflows/pkgdown.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
name: pkgdown.yaml
12+
13+
permissions: read-all
14+
15+
jobs:
16+
pkgdown:
17+
runs-on: ubuntu-latest
18+
# Only restrict concurrency for non-PR jobs
19+
concurrency:
20+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
21+
env:
22+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
permissions:
24+
contents: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: r-lib/actions/setup-pandoc@v2
29+
30+
- uses: r-lib/actions/setup-r@v2
31+
with:
32+
use-public-rspm: true
33+
34+
- name: Install system dependencies
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y grass-dev libgdal-dev libudunits2-dev libharfbuzz-dev libfribidi-dev
38+
39+
- uses: r-lib/actions/setup-r-dependencies@v2
40+
with:
41+
extra-packages: any::pkgdown, local::.
42+
needs: website
43+
44+
- name: Download test dataset
45+
run: |
46+
wget https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip -O /tmp/nc_basic_spm_grass7.zip
47+
unzip /tmp/nc_basic_spm_grass7.zip -d /tmp/grassdb
48+
rm /tmp/nc_basic_spm_grass7.zip
49+
50+
- name: Build site
51+
run: |
52+
gisBase <- system2("grass", "--config path", stdout = TRUE)
53+
rgrass::initGRASS(gisBase = gisBase, gisDbase = "/tmp/grassdb", location = "nc_basic_spm_grass7", mapset = "PERMANENT")
54+
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, run_dont_run = TRUE)
55+
shell: Rscript {0}
56+
57+
- name: Deploy to GitHub pages 🚀
58+
if: github.event_name != 'pull_request'
59+
uses: JamesIves/[email protected]
60+
with:
61+
clean: false
62+
branch: gh-pages
63+
folder: docs

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.httr-oauth
55
.DS_Store
66
*.Rproj
7+
docs

_pkgdown.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
url: https://osgeo.github.io/rgrass/
12
template:
23
bootstrap: 5
3-
url: https://osgeo.github.io/rgrass/
4+

0 commit comments

Comments
 (0)