Skip to content

build and deploy reactables #4607

build and deploy reactables

build and deploy reactables #4607

Workflow file for this run

name: build and deploy reactables
on:
push:
branches: main
schedule:
- cron: '10 */6 * * *'
jobs:
build-feeds:
if: github.repository_owner == 'carpentries'
runs-on: ubuntu-20.04
env:
RSPM: "https://packagemanager.rstudio.com/all/__linux__/focal/latest"
defaults:
run:
shell: bash
steps:
- name: checkout the Repository
uses: actions/checkout@v3
### Install R ------------------------------------------------------------
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
install-r: false
- name: Update apt
run: sudo apt update -y
- name: Set up dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
local::.
any::sessioninfo
# - name: Query dependencies
# run: |
# install.packages(setdiff(c('remotes', 'sessioninfo'), installed.packages()[, "Package"]))
# saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
# writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
# shell: Rscript {0}
# - name: Cache R packages
# uses: actions/cache@v2
# with:
# path: ${{ env.R_LIBS_USER }}
# key: ${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
# restore-keys: ${{ hashFiles('.github/R-version') }}-1-
# - name: Install system dependencies
# run: |
# sudo apt update
# while read -r cmd
# do
# eval sudo $cmd
# done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
# - name: Install dependencies
# run: |
# remotes::install_deps(dependencies = TRUE)
# ## for system packages
# update.packages(lib.loc = Sys.getenv("R_LIBS_USER"), ask = FALSE, checkBuilt = TRUE)
# shell: Rscript {0}
- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
### Run script -------------------------------------------------------------
- name: Run script that build table
run: |
source("script.R")
shell: Rscript {0}
- name: Check output
run: ls tmp/
### Upload to AWS S3 ---------------------------------------------------------
- name: Deploy to AWS S3
id: deploy
uses: fmichonneau/s3-sync-action@log-output
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: tmp/
- name: "Invalidate CloudFront"
uses: chetan/invalidate-cloudfront-action@master
env:
PATHS: /*
AWS_REGION: 'us-east-1'
DISTRIBUTION: ${{ secrets.DISTRIBUTION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}