-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (73 loc) · 3.05 KB
/
document-and-deploy.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: document-and-deploy
on:
push:
pull_request:
release:
jobs:
document-and-deploy:
# Skip deploy for automated (e.g., documentation) and [no-deploy] commits
if: "!contains(github.event.head_commit.message, '[automated]') && !contains(github.event.head_commit.message, '[no-deploy]')"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: r-lib/actions/setup-pandoc@v2
- name: Set up R version
uses: r-lib/actions/setup-r@v2
with:
r-version: "oldrel" # As shinyapps.io needs some time to catch up after releases
use-public-rspm: true
- name: Set up R Dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: devtools, roxygen2, remotes, rsconnect
- name: Create documentation
run: |
R -e "
file.remove('NAMESPACE');
descr <- readLines('DESCRIPTION');
descr <- stringr::str_replace(descr, '^Date.*$', paste('Date:', Sys.Date()));
writeLines(descr, 'DESCRIPTION');
roxygen2::roxygenise();
try(devtools::build_manual())
"
- name: commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add -f man/\* NAMESPACE
git commit -m 'Documentation' || echo "No changes to commit"
git push origin || echo "No changes to commit"
- name: Deploy to Shiny
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
R -e "
remotes::install_github('${{ github.repository }}', ref = '${{ github.ref_name }}', force = TRUE);
rsconnect::setAccountInfo(name='forrt-replications', token=${{secrets.SHINYAPPS_TOKEN}}, secret=${{secrets.SHINYAPPS_SECRET}});
rsconnect::deployApp(appName = 'fred_annotator', appDir = './inst/fred_annotator', forceUpdate = TRUE);
rsconnect::deployApp(appName = 'fred_explorer', appDir = './inst/fred_explorer', forceUpdate = TRUE);
"
- name: Deploy release version conditionally
if: github.event_name == 'release' && github.event.release.tag_name != '*test*'
run: |
R -e "
rsconnect::deployApp(appName = 'fred_explorer_release', appDir = './inst/fred_explorer', forceUpdate = TRUE);
rsconnect::deployApp(appName = 'fred_annotator_release', appDir = './inst/fred_annotator', forceUpdate = TRUE);
"
- name: Create pkgdown
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
R -e "
if (!require(FReD) remotes::install_local(force = TRUE);
options(pkgdown.internet = TRUE)
pkgdown::build_site_github_pages(new_process = FALSE)
"
- name: Deploy to GitHub pages 🚀
if: ${{ github.ref_name }} == 'main'
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: true
branch: gh-pages
folder: docs