-
Notifications
You must be signed in to change notification settings - Fork 3
62 lines (53 loc) · 1.6 KB
/
Copy pathrender-documentation.yaml
File metadata and controls
62 lines (53 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
## Workflow: Render Documentation
## objective:
## - Render *.Rd-files on CRAN-branch which has the CRAN version
## of the package *and* the R-universe version.
##
name: Render Documentation
## the workflow will run on
## on all branches but for CRAN
## branches it will also push *.Rd-files
on:
push:
branches: [CRAN]
pull_request:
branches: [CRAN]
workflow_dispatch:
## it needs the permission
## to read and write
permissions:
contents: write
jobs:
render-documentation:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- 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::devtools any::roxygen2
- name: Render documentation and NAMESPACE
run: devtools::document()
shell: Rscript {0}
- name: Push documentation
id: push
if: github.event_name == 'push'
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -f man/ NAMESPACE
if git diff --cached --quiet; then
echo "No documentation changes - nothing to commit."
else
git commit -m ":books: Rendered documentation"
git push origin CRAN
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
fi