diff --git a/.github/workflows/document-and-deploy-manual.yml b/.github/workflows/document-and-deploy-manual.yml index 4f3ec12..c4f4de2 100644 --- a/.github/workflows/document-and-deploy-manual.yml +++ b/.github/workflows/document-and-deploy-manual.yml @@ -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: @@ -14,7 +14,7 @@ env: _R_CHECK_FORCE_SUGGESTS_: "false" jobs: - document-and-deploy: + document-and-deploy-manual: runs-on: ubuntu-latest steps: @@ -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())); @@ -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 🚀 diff --git a/.github/workflows/document-and-deploy.yaml b/.github/workflows/document-and-deploy.yaml index 50137c8..917efa4 100644 --- a/.github/workflows/document-and-deploy.yaml +++ b/.github/workflows/document-and-deploy.yaml @@ -9,7 +9,6 @@ on: env: _R_CHECK_FORCE_SUGGESTS_: "false" - R_DEFAULT_REPOS: 'https://cloud.r-project.org/' jobs: document-and-deploy: @@ -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'); @@ -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 🚀