-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (94 loc) · 3.65 KB
/
main.yaml
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
on: push
jobs:
CICD:
runs-on: ubuntu-20.04
defaults:
run:
shell: Rscript {0}
container:
# update muggle here and in Dockerfile
image: subugoe/muggle-buildtime-onbuild:0.1.2-20210716
env:
MUGGLE_PKG_NAME: ${{ github.event.repository.name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CR_MD_MAILTO: ${{ github.event.pusher.email }}
CR_MD_PLUS_TOKEN: ${{ secrets.CR_MD_PLUS_TOKEN }}
MAILJET_SMTP_PASSWORD: ${{ secrets.MAILJET_SMTP_PASSWORD }}
steps:
- uses: actions/checkout@v2
- name: Cache R Packages
uses: actions/cache@v2
with:
# only cache the user library
path: |
.github/library
~/.metacheck-cache
key: ${{ job.container.image }}-${{ hashFiles('DESCRIPTION') }}
- name: Install System Dependencies
run: muggle::install_sysdeps()
- name: Install R Dependencies
env:
# see builder.Dockerfile for explanation, this resets after this step
R_LIBS_SITE: $R_LIBS_RUNTIME_GH
run: remotes::install_deps(dependencies = TRUE)
- name: Check
run: |
shinytest::installDependencies()
devtools::check(error_on = "warning")
- name: Build Package Website
run: |
muggle::build_site2(override = list(new_process = FALSE))
- name: Build Buildtime Image
uses: docker/build-push-action@v1
with:
repository: ${{ github.repository }}/${{ env.MUGGLE_PKG_NAME }}-buildtime
target: buildtime
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
# this will set "latest" if master as per https://github.com/docker/build-push-action
tag_with_ref: true
# we're relying on long shas only to keep things easy
tag_with_sha: false
tags: ${{ github.sha }}
add_git_labels: true
push: ${{ github.event_name != 'pull_request' }}
- name: Build Runtime Image
uses: docker/build-push-action@v1
with:
repository: ${{ github.repository }}/${{ env.MUGGLE_PKG_NAME }}-runtime
target: runtime
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
# this will set "latest" if master as per https://github.com/docker/build-push-action
tag_with_ref: true
# we're relying on long shas only to keep things easy
tag_with_sha: false
tags: ${{ github.sha }}
add_git_labels: true
push: ${{ github.event_name != 'pull_request' }}
- name: Deploy to Shinyapps.io
if: ${{ github.event_name == 'push' }} && ${{ github.ref_name == 'main' }}
run: |
remotes::install_local()
# need to install again to get packrat magic to work
metacheck:::install_for_packrat(
ref = "${{ github.ref_name }}"
)
# auth from gha secrets
rsconnect::setAccountInfo(
name = "${{ secrets.SAIO_USER }}",
token = "${{ secrets.SAIO_TOKEN }}",
secret = "${{ secrets.SAIO_SECRET }}"
)
# pass on secrets to saio
metacheck:::write_env_var("MAILJET_SMTP_PASSWORD")
metacheck:::write_env_var("CR_MD_MAILTO")
metacheck:::write_env_var("CR_MD_PLUS_TOKEN")
metacheck::deployAppSaio()
- name: Deploy to GitHub Pages
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
uses: maxheld83/ghpages@github-token
env:
BUILD_DIR: docs