Skip to content

Commit

Permalink
Update deploy actions
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasWallrich committed Nov 10, 2024
1 parent 5951167 commit ebe962a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/document-and-deploy-manual.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Run CI for R using https://eddelbuettel.github.io/r-ci/

name: document-and-deploy
name: document-and-deploy-manual

on:
workflow_dispatch:
Expand All @@ -14,7 +14,7 @@ env:
_R_CHECK_FORCE_SUGGESTS_: "false"

jobs:
document-and-deploy:
document-and-deploy-manual:
runs-on: ubuntu-latest

steps:
Expand All @@ -27,11 +27,16 @@ jobs:
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ github.event.inputs.rversion }}
use-public-rspm: true

- name: Set up R Dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: devtools, plogr, roxygen2, remotes, rsconnect, pkgdown

- name: Create documentation
run: |
R -e "
install.packages(c('rcmdcheck', 'roxygen2', 'devtools'));
file.remove('NAMESPACE');
descr <- readLines('DESCRIPTION');
descr <- stringr::str_replace(descr, '^Date.*$', paste('Date:', Sys.Date()));
Expand All @@ -49,29 +54,31 @@ jobs:
git push origin || echo "No changes to commit"
- name: Deploy latest from dev
if: ${{ github.ref_name }} == 'dev'
if: github.ref == 'refs/heads/dev'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
R -e "
install.packages(c('rsconnect', 'remotes'));
remotes::install_github('ESHackathon/CiteSource', force = TRUE);
rsconnect::setAccountInfo(name=${{secrets.SHINY_LUKAS_ACCOUNT}}, token=${{secrets.SHINY_LUKAS_TOKEN}}, secret=${{secrets.SHINY_LUKAS_SECRET}});
rsconnect::deployApp(appName = 'CiteSource_latest', appDir = './inst/shiny-app/CiteSource', forceUpdate = TRUE)"
- name: Deploy stable version from main
if: ${{ github.ref_name }} == 'main' || ${{ github.ref_name }} == 'master'
if: github.ref == 'refs/heads/main'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
R -e "
install.packages(c('rsconnect', 'remotes'));
remotes::install_github('ESHackathon/CiteSource', force = TRUE);
rsconnect::setAccountInfo(name=${{secrets.SHINY_LUKAS_ACCOUNT}}, token=${{secrets.SHINY_LUKAS_TOKEN}}, secret=${{secrets.SHINY_LUKAS_SECRET}});
rsconnect::deployApp(appName = 'CiteSource', appDir = './inst/shiny-app/CiteSource', forceUpdate = TRUE)"
- name: Create pkgdown
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
R -e "
install.packages('pkgdown');
if (!require(CiteSource)) remotes::install_github('ESHackathon/CiteSource', force = TRUE);
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)"
- name: Deploy to GitHub pages 🚀
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/document-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:

env:
_R_CHECK_FORCE_SUGGESTS_: "false"
R_DEFAULT_REPOS: 'https://cloud.r-project.org/'

jobs:
document-and-deploy:
Expand All @@ -36,7 +35,6 @@ jobs:
- name: Create documentation
run: |
R -e "
options(repos = c(CRAN = 'https://cloud.r-project.org/'));
install.packages(c('rcmdcheck', 'roxygen2', 'devtools'));
file.remove('NAMESPACE');
descr <- readLines('DESCRIPTION');
Expand All @@ -54,30 +52,38 @@ jobs:
git commit -m 'Documentation' || echo "No changes to commit"
git push origin || echo "No changes to commit"
- name: Deploy latest from dev
- name: Deploy latest (from dev)
if: github.ref == 'refs/heads/dev'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
R -e "
options(repos = c(CRAN = 'https://cloud.r-project.org/'));
install.packages(c('rsconnect', 'remotes'));
bspm::disable();
remotes::install_github('ESHackathon/CiteSource', force = TRUE);
remotes::install_github('ESHackathon/CiteSource', ref = "dev", force = TRUE);
rsconnect::setAccountInfo(name=${{secrets.SHINY_LUKAS_ACCOUNT}}, token=${{secrets.SHINY_LUKAS_TOKEN}}, secret=${{secrets.SHINY_LUKAS_SECRET}});
rsconnect::deployApp(appName = 'CiteSource_latest', appDir = './inst/shiny-app/CiteSource', forceUpdate = TRUE)"
- name: Deploy stable version from main
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
- name: Deploy stable version (from main)
if: github.ref == 'refs/heads/main'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
R -e "
options(repos = c(CRAN = 'https://cloud.r-project.org/'));
install.packages(c('rsconnect', 'remotes'));
bspm::disable();
remotes::install_github('ESHackathon/CiteSource', force = TRUE);
rsconnect::setAccountInfo(name=${{secrets.SHINY_LUKAS_ACCOUNT}}, token=${{secrets.SHINY_LUKAS_TOKEN}}, secret=${{secrets.SHINY_LUKAS_SECRET}});
rsconnect::deployApp(appName = 'CiteSource', appDir = './inst/shiny-app/CiteSource', forceUpdate = TRUE)"
- name: Create pkgdown
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
R -e "
install.packages('pkgdown');
bspm::disable();
if (!require(CiteSource)) remotes::install_github('ESHackathon/CiteSource', force = TRUE);
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)"
- name: Deploy to GitHub pages 🚀
Expand Down

0 comments on commit ebe962a

Please sign in to comment.