-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify actions and deploy from "oldrel" version (robust for shinyap…
…ps.io - closes #66)
- Loading branch information
1 parent
a6cb37a
commit 7934de2
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
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 "actions@github.com" | ||
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::remotes::install_local(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 " | ||
appDir <- system.file('fred_explorer', package = 'FReD'); | ||
rsconnect::deployApp(appName = 'fred_explorer_release', appDir = './inst/fred_explorer', forceUpdate = TRUE); | ||
appDir <- system.file('fred_annotator', package = 'FReD'); | ||
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::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 |
File renamed without changes.