-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (89 loc) · 5.25 KB
/
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Deploy
on:
push:
branches:
- deploy**
- ghactions
# # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onschedule
# schedule:
# - cron: '0 6 * * 1-5' # every work night (delayed 0 hrs)
repository_dispatch:
types:
- all
- deploy
jobs:
config:
uses: ./.github/workflows/ci-config.yml
deploy:
runs-on: ${{ matrix.config.os }}
name: "${{ matrix.config.type }} (${{ matrix.config.r }})"
strategy:
fail-fast: false
matrix:
config:
- { os: macOS-latest, r: 'release', type: "shinyappsio", account: "testing-apps", server_name: "shinyapps.io", cores: 5, retry: 3 }
# beta.rstudioconnect does not support R v4.0 yet
# - { os: macOS-latest, r: '3.6', type: "connect", account: "barret", server_name: "beta.rstudioconnect.com", server_url: "https://beta.rstudioconnect.com/__api__", cores: 1, retry: 3 }
- { os: ubuntu-18.04, r: 'release', release: "bionic", type: "connect", account: "barret", server_name: "beta.rstudioconnect.com", server_url: "https://beta.rstudioconnect.com/__api__", cores: 1, retry: 3 }
# - { os: macOS-latest, r: '4.0', type: "shinyappsio", account: "testing-apps", server_name: "shinyapps.io", cores: 1, retry: 3, extra_app_text: ", apps = c('001-hello', '002-text')" }
# beta.rstudioconnect does not support v4 yet
# - { os: macOS-latest, r: '3.6', type: "connect", account: "barret", server_name: "beta.rstudioconnect.com", server_url: "https://beta.rstudioconnect.com/__api__", cores: 1, retry: 3, extra_app_text: ", apps = c('001-hello', '002-text')" }
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
name: GitHub Pull
- name: R Options
shell: bash
run: |
echo 'MAKEFLAGS=-j2' >> .Renviron
- name: Install shinycoreciapps
uses: rstudio/shiny-workflows/setup-r-package@v1
with:
needs: install
r-version: ${{ matrix.config.r }}
# add suffix so that prefix matching works but key is diff than ci-runtests-os.yml cache key
cache-version: ${{ needs.config.outputs.cache-version }}-deploy
extra-packages:
rstudio/shinycoreci,
any::rsconnect
- name: Install app deps
run: >
Rscript
-e "shinycoreci::install_exact_shinycoreci_deps(dir = 'apps', apps = shinycoreci::apps_deploy('apps'))"
# -e "if (system.file(package = 'rsconnect') == '') remotes::install_cran('rsconnect')"
# -e "if (system.file(package = 'plogr') == '') remotes::install_cran('plogr')"
# -e "## 141-radiant"
# -e "if (system.file(package = 'RcppEigen') == '') remotes::install_cran('RcppEigen')"
# -e "## 141-radiant"
# -e "if (system.file(package = 'radiant') == '') remotes::install_cran('radiant', dependencies = TRUE)"
- name: Deploy Apps to Shinyapps.io
if: matrix.config.type == 'shinyappsio'
run: >
Rscript
-e "## options(pkgType = 'binary')"
-e "rsconnect::setAccountInfo(name='${{ matrix.config.account }}', token='${{ secrets.shinyapps_io_testing_apps_token }}', secret='${{ secrets.shinyapps_io_testing_apps_secret }}')"
-e "shinycoreci::deploy_apps(dir = 'apps', retry = ${{ matrix.config.retry }}, cores = ${{ matrix.config.cores }}, account = '${{ matrix.config.account }}', server = '${{ matrix.config.server_name }}'${{ matrix.config.extra_app_text }})"
- name: Deploy Apps to Connect
if: matrix.config.type == 'connect'
run: >
Rscript
-e "## add server info"
-e "rsconnect::addConnectServer(url = '${{ matrix.config.server_url }}', name = '${{ matrix.config.server_name }}')"
-e "## add user info"
-e "rsconnect::connectApiUser('${{ matrix.config.account }}', '${{ matrix.config.server_name }}', apiKey = '${{ secrets.barret_beta_rstudioconnect_com_API_key }}')"
-e "## deploy"
-e "shinycoreci::deploy_apps(dir = 'apps', retry = ${{ matrix.config.retry }}, cores = ${{ matrix.config.cores }}, account = '${{ matrix.config.account }}', server = '${{ matrix.config.server_name }}'${{ matrix.config.extra_app_text }})"
-e "## make public"
-e "shinycoreci::connect_set_public(dir = 'apps', account = '${{ matrix.config.account }}', server = '${{ matrix.config.server_name }}'${{ matrix.config.extra_app_text }})"
-e "## save ALL urls"
-e "shinycoreci::connect_urls_cache_save(dir = 'apps', account = '${{ matrix.config.account }}', server = '${{ matrix.config.server_name }}'${{ matrix.config.extra_connect_app_text }})"
- name: Save Connect Urls to Repo
if: matrix.config.type == 'connect'
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add ./zzz_shinycoreci
git commit -m 'Generate Connect URLs (GitHub Actions)' || echo "No Connect URL changes to commit"
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{ github.ref }} || echo "No Connect URLs to push"