10
10
paths :
11
11
- ' **.Rmd'
12
12
- assets/*
13
+ - quizzes/*
13
14
14
15
jobs :
15
16
18
19
runs-on : ubuntu-latest
19
20
steps :
20
21
- name : Checkout
21
- uses : actions/checkout@v3
22
+ uses : actions/checkout@v4
22
23
23
24
# Use the yaml-env-action action.
24
25
- name : Load environment from YAML
29
30
toggle_bookdown : " ${{ env.RENDER_BOOKDOWN }}"
30
31
toggle_coursera : " ${{ env.RENDER_COURSERA }}"
31
32
toggle_leanpub : " ${{ env.RENDER_LEANPUB }}"
33
+ make_book_txt : " ${{ env.MAKE_BOOK_TXT }}"
32
34
rendering_docker_image : " ${{ env.RENDERING_DOCKER_IMAGE }}"
33
35
toggle_quiz_check : " ${{ env.CHECK_QUIZZES }}"
34
36
@@ -42,16 +44,16 @@ jobs:
42
44
43
45
steps :
44
46
- name : checkout
45
- uses : actions/checkout@v3
47
+ uses : actions/checkout@v4
46
48
with :
47
49
fetch-depth : 0
48
50
token : ${{ secrets.GH_PAT }}
49
51
50
52
- name : Login as jhudsl-robot
51
53
run : |
52
- git config --system --add safe.directory " $GITHUB_WORKSPACE"
53
- git config --local user.email "[email protected] "
54
- git config --local user.name "jhudsl-robot"
54
+ git config --global --add safe.directory $GITHUB_WORKSPACE
55
+ git config --global user.email "[email protected] "
56
+ git config --global user.name "jhudsl-robot"
55
57
56
58
# We want a fresh run of the renders each time
57
59
- name : Delete old docs/*
@@ -78,10 +80,11 @@ jobs:
78
80
GH_PAT : ${{ secrets.GH_PAT }}
79
81
run : |
80
82
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
83
+ git fetch origin
81
84
git add --force docs/*
82
85
git commit -m 'Render bookdown' || echo "No changes to commit"
83
86
git pull --allow-unrelated-histories --strategy-option=ours
84
- git push origin main || echo "No changes to push"
87
+ git push -u origin main || echo "No changes to push"
85
88
86
89
render-tocless :
87
90
name : Render TOC-less version for Leanpub or Coursera
@@ -93,15 +96,16 @@ jobs:
93
96
94
97
steps :
95
98
- name : checkout
96
- uses : actions/checkout@v3
99
+ uses : actions/checkout@v4
97
100
with :
98
101
fetch-depth : 0
99
102
token : ${{ secrets.GH_PAT }}
100
103
101
104
- name : Login as jhudsl-robot
102
105
run : |
103
- git config --local user.email "[email protected] "
104
- git config --local user.name "jhudsl-robot"
106
+ git config --global --add safe.directory $GITHUB_WORKSPACE
107
+ git config --global user.email "[email protected] "
108
+ git config --global user.name "jhudsl-robot"
105
109
106
110
# Rendered content for Leanpub and Coursera is very similar.
107
111
# This job creates a shared scaffold for both.
@@ -115,10 +119,11 @@ jobs:
115
119
GH_PAT : ${{ secrets.GH_PAT }}
116
120
run : |
117
121
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
122
+ git fetch origin
118
123
git add --force docs/no_toc*
119
124
git commit -m 'Render toc-less' || echo "No changes to commit"
120
125
git pull --allow-unrelated-histories --strategy-option=ours
121
- git push origin main || echo "No changes to push"
126
+ git push -u origin main || echo "No changes to push"
122
127
123
128
render-leanpub :
124
129
name : Finish Leanpub prep
@@ -130,15 +135,16 @@ jobs:
130
135
131
136
steps :
132
137
- name : checkout
133
- uses : actions/checkout@v3
138
+ uses : actions/checkout@v4
134
139
with :
135
140
fetch-depth : 0
136
141
token : ${{ secrets.GH_PAT }}
137
142
138
143
- name : Login as jhudsl-robot
139
144
run : |
140
- git config --local user.email "[email protected] "
141
- git config --local user.name "jhudsl-robot"
145
+ git config --global --add safe.directory $GITHUB_WORKSPACE
146
+ git config --global user.email "[email protected] "
147
+ git config --global user.name "jhudsl-robot"
142
148
143
149
# Create screenshots
144
150
- name : Run the screenshot creation
@@ -153,16 +159,25 @@ jobs:
153
159
--output_dir resources/chapt_screen_images)
154
160
155
161
# We want a fresh run of the renders each time
156
- - name : Delete old manuscript/
157
- run : rm -rf manuscript/
162
+ - name : Delete manuscript/
163
+ env :
164
+ GH_PAT : ${{ secrets.GH_PAT }}
165
+ run : |
166
+ rm -rf manuscript/
167
+ git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
168
+ git fetch origin
169
+ git add .
170
+ git commit -m 'Delete manuscript folder' || echo "No changes to commit"
171
+ git pull --allow-unrelated-histories --strategy-option=ours
172
+ git push -u origin main || echo "No changes to push"
158
173
159
174
- name : Run ottrpal::bookdown_to_embed_leanpub
160
175
if : needs.yaml-check.outputs.toggle_quiz_check == 'no'
161
176
run : |
162
177
Rscript -e "ottrpal::bookdown_to_embed_leanpub(
163
178
render = FALSE, \
164
179
chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \
165
- make_book_txt = TRUE , \
180
+ make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}') , \
166
181
quiz_dir = NULL)"
167
182
168
183
- name : Run ottrpal::bookdown_to_embed_leanpub
@@ -171,21 +186,20 @@ jobs:
171
186
Rscript -e "ottrpal::bookdown_to_embed_leanpub(
172
187
render = FALSE, \
173
188
chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \
174
- make_book_txt = TRUE )"
189
+ make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}') )"
175
190
176
191
# Commit the rendered Leanpub files
177
192
- name : Commit rendered Leanpub files
178
193
env :
179
194
GH_PAT : ${{ secrets.GH_PAT }}
180
195
run : |
181
196
mkdir -p manuscript
182
- git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
183
197
git add --force manuscript/*
184
198
git add --force resources/*
185
199
git add --force docs/*
186
200
git commit -m 'Render Leanpub' || echo "No changes to commit"
187
201
git pull --allow-unrelated-histories --strategy-option=ours
188
- git push origin main || echo "No changes to push"
202
+ git push --force --set-upstream origin main || echo "No changes to push"
189
203
190
204
render-coursera :
191
205
name : Finish Coursera prep
@@ -197,15 +211,16 @@ jobs:
197
211
198
212
steps :
199
213
- name : checkout
200
- uses : actions/checkout@v3
214
+ uses : actions/checkout@v4
201
215
with :
202
216
fetch-depth : 0
203
217
token : ${{ secrets.GH_PAT }}
204
218
205
219
- name : Login as jhudsl-robot
206
220
run : |
207
- git config --local user.email "[email protected] "
208
- git config --local user.name "jhudsl-robot"
221
+ git config --global --add safe.directory $GITHUB_WORKSPACE
222
+ git config --global user.email "[email protected] "
223
+ git config --global user.name "jhudsl-robot"
209
224
210
225
# Run Coursera version
211
226
- name : Convert Leanpub quizzes to Coursera
@@ -219,9 +234,10 @@ jobs:
219
234
GH_PAT : ${{ secrets.GH_PAT }}
220
235
run : |
221
236
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
237
+ git fetch origin
222
238
git add --force manuscript/*
223
239
git add --force resources/*
224
240
git add --force docs/*
225
241
git commit -m 'Render Coursera quizzes' || echo "No changes to commit"
226
242
git pull --allow-unrelated-histories --strategy-option=ours
227
- git push origin main || echo "No changes to push"
243
+ git push -u origin main || echo "No changes to push"
0 commit comments