-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.6 KB
/
daily-image-run.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
on:
schedule:
- cron: "0 11 * * *"
jobs:
generate-data:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
- uses: r-lib/actions/setup-pandoc@v2
- name: Install libcurl (for curl/httr)
run: |
sudo apt-get install libcurl4-openssl-dev -y
- name: Install libmagick (for the magick package)
run: |
sudo apt-get install libmagick++-dev
- name: Install R packages
run: |
install.packages(c("dplyr", "purrr", "httr", "knitr", "jpeg", "magick", "sketcher", "scales", "blogdown", "rtweet"), Ncpus = 2)
shell: Rscript {0}
- name: Generate Image
env:
SMUGMUG_KEY: ${{ secrets.SMUGMUG_KEY }}
SMUGMUG_SECRET: ${{ secrets.SMUGMUG_SECRET }}
run: |
source("content/image-randomize/master.R")
shell: Rscript {0}
- name: Build Site
run: |
blogdown::build_site(run_hugo = FALSE,
build_rmd = TRUE)
shell: Rscript {0}
- name: Commit files
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add --all
git commit -am "Add newly processed image"
git push
# Changes to the Twitter API - deprecation of 1.1 and v2 requiring
# OAuth / browser authentication AND not allowing for media in posts
# has driven the following to fail. See:
# https://github.com/ropensci/rtweet/issues/778
# - name: Sleep for 5 minutes while site rebuilds
# uses: juliangruber/sleep-action@v1
# with:
# time: 5m
#
# - name: Tweet the Result
# env:
# TWITTER_APPNAME: ${{ secrets.TWITTER_APPNAME }}
# TWITTER_KEY: ${{ secrets.TWITTER_KEY }}
# TWITTER_SECRET: ${{ secrets.TWITTER_SECRET }}
# TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
# TWITTER_ACCESS_SECRET: ${{ secrets.TWITTER_ACCESS_SECRET }}
# run: |
# source("content/image-randomize/post_tweet.R")
# shell: Rscript {0}