-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (113 loc) · 4.46 KB
/
main.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Update-data
on:
workflow_dispatch:
schedule:
- cron: "0 23 * * 2"
- cron: "0 23 * * 5"
jobs:
ncsl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main # Checkout branch into the runner
- uses: r-lib/actions/setup-r@v2-branch # Set up R runtime
with:
r-version: '4.3.3'
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Setup renv # Set up R env to install packages
run: |
install.packages('remotes')
install.packages("renv")
system("sudo apt-get install libcurl4-openssl-dev")
shell: Rscript {0}
- uses: actions/cache@v2 # Cache packages so won't be compiled everytime job is run
with:
path: ~/.local/share/renv
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Install dependencies # Install the dependencies eg. Dplyr, tidyverse etc
run: renv::restore()
shell: Rscript {0}
- name: Generate data # Run the script
run: source("code/ncsl.R")
shell: Rscript {0}
- name: Commit files # Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git pull origin main
git add -A
git diff-index --quiet HEAD || (git commit -m "update published ncsl data ${{ steps.date.outputs.date }}" && git push)
vrl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main # Checkout branch into the runner
- uses: r-lib/actions/setup-r@v2-branch # Set up R runtime
with:
r-version: '4.3.3'
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Setup renv # Set up R env to install packages
run: |
install.packages('remotes')
install.packages("renv")
system("sudo apt-get install libcurl4-openssl-dev")
shell: Rscript {0}
- uses: actions/cache@v2 # Cache packages so won't be compiled everytime job is run
with:
path: ~/.local/share/renv
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Install dependencies # Install the dependencies eg. Dplyr, tidyverse etc
run: renv::restore()
shell: Rscript {0}
- name: Generate data # Run the script
run: source("code/vrl.R")
shell: Rscript {0}
- name: Commit files # Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git pull origin main
git add -A
git diff-index --quiet HEAD || (git commit -m "update published vrl data ${{ steps.date.outputs.date }}" && git push)
update-docs:
runs-on: ubuntu-latest
needs: [ncsl,vrl]
steps:
- uses: actions/checkout@main # Checkout branch into the runner
- uses: r-lib/actions/setup-r@v2-branch # Set up R runtime
with:
r-version: '4.3.3'
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Setup renv # Set up R env to install packages
run: |
install.packages('remotes')
install.packages("renv")
system("sudo apt-get install libcurl4-openssl-dev")
shell: Rscript {0}
- uses: actions/cache@v2 # Cache packages so won't be compiled everytime job is run
with:
path: ~/.local/share/renv
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Install dependencies # Install the dependencies eg. Dplyr, tidyverse etc
run: renv::restore()
shell: Rscript {0}
- name: Generate data # Run the script
run: source("code/update_documentation.R")
shell: Rscript {0}
- name: Commit files # Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git pull origin main
git add -A
git diff-index --quiet HEAD || (git commit -m "update readme ${{ steps.date.outputs.date }}" && git push)