File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,8 @@ RUN apt install -y \
109
109
rsync \
110
110
sed \
111
111
software-properties-common \
112
- wget
112
+ wget \
113
+ yq
113
114
114
115
# Install Chromium via custom repo
115
116
# https://askubuntu.com/questions/1204571/how-to-install-chromium-without-snap/1511695#1511695
Original file line number Diff line number Diff line change 210
210
211
211
# Mark globals set from the command line as readonly when we're done updating them.
212
212
readonly RESOURCE_DIR
213
- readonly DO_GITVERSION
214
213
readonly DO_GITSTATUS
215
214
readonly VERSIONED_FILENAMES
216
215
readonly PR_NUMBER
@@ -297,6 +296,27 @@ if ! browser=$(command -v "chromium-browser"); then
297
296
fi
298
297
fi
299
298
299
+ # If any of the following values are provided in the YAML metadata block,
300
+ # use the values from the metadata block instead of doing git-based versioning:
301
+ # * version
302
+ # * revision
303
+ # * status
304
+ # NOTE: While Pandoc allows the YAML metadata to be anywhere in the document,
305
+ # we require it to be up at the top.
306
+ # Use sed to strip the '...' at the end of the YAML metadata block, and yq to
307
+ # parse it for fields of interest.
308
+ yaml_version=$( sed ' /\.\.\./Q' ${INPUT_FILE} | yq ' .version' )
309
+ yaml_revision=$( sed ' /\.\.\./Q' ${INPUT_FILE} | yq ' .revision' )
310
+ yaml_status=$( sed ' /\.\.\./Q' ${INPUT_FILE} | yq ' .status' )
311
+ echo " YAML version: ${yaml_version} "
312
+ echo " YAML revision: ${yaml_revision} "
313
+ echo " YAML status: ${yaml_status} "
314
+ if [[ " ${yaml_version} " != " null" ]] || [[ " ${yaml_revision} " != " null" ]] || [[ " ${yaml_status} " != " null" ]]; then
315
+ echo " Disabling Git-based versioning because version information was found in the YAML metadata block."
316
+ DO_GITVERSION=false
317
+ fi
318
+ readonly DO_GITVERSION
319
+
300
320
# figure out git version and revision if needed.
301
321
EXTRA_PANDOC_OPTIONS=" "
302
322
if test " ${DO_GITVERSION} " == " yes" ; then
You can’t perform that action at this time.
0 commit comments