-
Notifications
You must be signed in to change notification settings - Fork 10
66 lines (60 loc) · 2.37 KB
/
sync.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
name: daily-sync
on:
workflow_dispatch
jobs:
test-data:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: r-lib/actions/setup-r@v2-branch
- name: Install R packages
run: Rscript -e 'install.packages(c("devtools","aws.s3","usethis"))'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests on data on s3
run: Rscript -e 'install.packages(c("devtools","aws.s3","usethis"))' -e 'b <- Sys.getenv("BUCKET")' \
-e 'aws.s3::s3load(bucket = b, object = "ufc_stats.rda")' \
-e 'usethis::use_data(ufc_stats, overwrite = TRUE)' -e 'devtools::check(error_on = "error")'
env:
ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BUCKET: ${{ secrets.AWS_S3_BUCKET }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
sync-data:
needs: test-data
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: mtoto/s3-sync-action@master
with:
args: --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 }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: ${{ secrets.SOURCE_DIR }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
DEST_DIR: 'data'
DEST_FILE: 'ufc_stats.rda'
update-readme:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: r-lib/actions/setup-r@v2-branch
- uses: r-lib/actions/setup-pandoc@v2-branch
- name: Install rmarkdown
run: Rscript -e 'install.packages(c("rmarkdown","devtools"))'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Render README
run: Rscript -e 'rmarkdown::render("README.Rmd")'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Commit results
run: |
git pull origin master && git diff --quiet && git diff --staged --quiet || git commit -am "Re-build README.Rmd & update datasets"
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:master