R Shiny App deployment fails in github actions but not locally

Run rsconnect::setAccountInfo(name='***', token='***', secret='***')
  rsconnect::setAccountInfo(name='***', token='***', secret='***')
  rsconnect::deployApp()
  shell: C:\R\bin\Rscript.EXE {0}
  env:
    R_LIBS_USER: D:\a\_temp\Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
Preparing to deploy application...DONE
Warning in FUN(X[[i]], ...) :
  Unable to find repository URL for package Matrix
Error: 
* Application depends on package "RColorBrewer" but it is not
   installed. Please resolve before continuing.

* Application depends on package "assertthat" but it is not installed.
   Please resolve before continuing.

* Application depends on package "brio" but it is not installed.
   Please resolve before continuing.

deployment fails even though package installation succeeded:

Run install.packages(c("shiny", "rsconnect"), type= 'binary')
  install.packages(c("shiny", "rsconnect"), type= 'binary')
  shell: C:\R\bin\Rscript.EXE {0}
  env:
    R_LIBS_USER: D:\a\_temp\Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
Installing packages into 'D:/a/_temp/Library'
(as 'lib' is unspecified)

  There is a binary version available (and will be installed) but the
  source version is later:
       binary source
shiny 1.4.0.2  1.6.0

also installing the dependencies 'sys', 'Rcpp', 'BH', 'magrittr', 'askpass', 'httpuv', 'mime', 'jsonlite', 'xtable', 'digest', 'htmltools', 'R6', 'sourcetools', 'later', 'promises', 'crayon', 'rlang', 'fastmap', 'curl', 'openssl', 'packrat', 'rstudioapi', 'yaml'

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/sys_3.3.zip'
Content type 'application/zip' length 59539 bytes (58 KB)
==================================================
downloaded 58 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/Rcpp_1.0.4.6.zip'
Content type 'application/zip' length 3050774 bytes (2.9 MB)
==================================================
downloaded 2.9 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/BH_1.72.0-3.zip'
Content type 'application/zip' length 18270616 bytes (17.4 MB)
==================================================
downloaded 17.4 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/magrittr_1.5.zip'
Content type 'application/zip' length 155738 bytes (152 KB)
==================================================
downloaded 152 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/askpass_1.1.zip'
Content type 'application/zip' length 64385 bytes (62 KB)
==================================================
downloaded 62 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/httpuv_1.5.2.zip'
Content type 'application/zip' length 1515339 bytes (1.4 MB)
==================================================
downloaded 1.4 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/mime_0.9.zip'
Content type 'application/zip' length 48051 bytes (46 KB)
==================================================
downloaded 46 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/jsonlite_1.6.1.zip'
Content type 'application/zip' length 1164207 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/xtable_1.8-4.zip'
Content type 'application/zip' length 704829 bytes (688 KB)
==================================================
downloaded 688 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/digest_0.6.25.zip'
Content type 'application/zip' length 248623 bytes (242 KB)
==================================================
downloaded 242 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/htmltools_0.4.0.zip'
Content type 'application/zip' length 690367 bytes (674 KB)
==================================================
downloaded 674 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/R6_2.4.1.zip'
Content type 'application/zip' length 58853 bytes (57 KB)
==================================================
downloaded 57 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/sourcetools_0.1.7.zip'
Content type 'application/zip' length 530454 bytes (518 KB)
==================================================
downloaded 518 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/later_1.0.0.zip'
Content type 'application/zip' length 664123 bytes (648 KB)
==================================================
downloaded 648 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/promises_1.1.0.zip'
Content type 'application/zip' length 1785579 bytes (1.7 MB)
==================================================
downloaded 1.7 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/crayon_1.3.4.zip'
Content type 'application/zip' length 749069 bytes (731 KB)
==================================================
downloaded 731 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/rlang_0.4.5.zip'
Content type 'application/zip' length 1115838 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/fastmap_1.0.1.zip'
Content type 'application/zip' length 413149 bytes (403 KB)
==================================================
downloaded 403 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/curl_4.3.zip'
Content type 'application/zip' length 4125957 bytes (3.9 MB)
==================================================
downloaded 3.9 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/openssl_1.4.1.zip'
Content type 'application/zip' length 3968715 bytes (3.8 MB)
==================================================
downloaded 3.8 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/packrat_0.5.0.zip'
Content type 'application/zip' length 451235 bytes (440 KB)
==================================================
downloaded 440 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/rstudioapi_0.11.zip'
Content type 'application/zip' length 277959 bytes (271 KB)
==================================================
downloaded 271 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/yaml_2.2.1.zip'
Content type 'application/zip' length 205770 bytes (200 KB)
==================================================
downloaded 200 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/shiny_1.4.0.2.zip'
Content type 'application/zip' length 4928842 bytes (4.7 MB)
==================================================
downloaded 4.7 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/rsconnect_0.8.16.zip'
Content type 'application/zip' length 644572 bytes (629 KB)
==================================================
downloaded 629 KB

package 'sys' successfully unpacked and MD5 sums checked
package 'Rcpp' successfully unpacked and MD5 sums checked
package 'BH' successfully unpacked and MD5 sums checked
package 'magrittr' successfully unpacked and MD5 sums checked
package 'askpass' successfully unpacked and MD5 sums checked
package 'httpuv' successfully unpacked and MD5 sums checked
package 'mime' successfully unpacked and MD5 sums checked
package 'jsonlite' successfully unpacked and MD5 sums checked
package 'xtable' successfully unpacked and MD5 sums checked
package 'digest' successfully unpacked and MD5 sums checked
package 'htmltools' successfully unpacked and MD5 sums checked
package 'R6' successfully unpacked and MD5 sums checked
package 'sourcetools' successfully unpacked and MD5 sums checked
package 'later' successfully unpacked and MD5 sums checked
package 'promises' successfully unpacked and MD5 sums checked
package 'crayon' successfully unpacked and MD5 sums checked
package 'rlang' successfully unpacked and MD5 sums checked
package 'fastmap' successfully unpacked and MD5 sums checked
package 'curl' successfully unpacked and MD5 sums checked
package 'openssl' successfully unpacked and MD5 sums checked
package 'packrat' successfully unpacked and MD5 sums checked
package 'rstudioapi' successfully unpacked and MD5 sums checked
package 'yaml' successfully unpacked and MD5 sums checked
package 'shiny' successfully unpacked and MD5 sums checked
package 'rsconnect' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\runneradmin\AppData\Local\Temp\RtmpoZDUGD\downloaded_packages

using the RStudio UI the deployment succeeds.

Here is the github actions file:

on:
  push:
    branches:
      - master

name: deploy-shiny

jobs:
  deploy-shiny:
    runs-on: windows-2019 
    steps:
      - uses: actions/checkout@v2
      - uses: r-lib/actions/setup-r@v1
        with:
          r-version: '3.5.3'
      - name: Install shiny
        run: |
          install.packages(c("shiny", "rsconnect"), type= 'binary')
        shell: Rscript {0}
      - name: Push to shiny.io
        run: |
          rsconnect::setAccountInfo(name='${{ secrets.SHINYAPPS_USERNAME }}', token='${{secrets.SHINYAPPS_TOKEN}}', secret='${{secrets.SHINYAPPS_SECRET}}')
          rsconnect::deployApp()
        shell: Rscript {0}