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 \
109109 rsync \
110110 sed \
111111 software-properties-common \
112- wget
112+ wget \
113+ yq
113114
114115# Install Chromium via custom repo
115116# https://askubuntu.com/questions/1204571/how-to-install-chromium-without-snap/1511695#1511695
Original file line number Diff line number Diff line change 210210
211211# Mark globals set from the command line as readonly when we're done updating them.
212212readonly RESOURCE_DIR
213- readonly DO_GITVERSION
214213readonly DO_GITSTATUS
215214readonly VERSIONED_FILENAMES
216215readonly PR_NUMBER
@@ -297,6 +296,27 @@ if ! browser=$(command -v "chromium-browser"); then
297296 fi
298297fi
299298
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+
300320# figure out git version and revision if needed.
301321EXTRA_PANDOC_OPTIONS=" "
302322if test " ${DO_GITVERSION} " == " yes" ; then
You can’t perform that action at this time.
0 commit comments