Skip to content

Commit 40cb2f0

Browse files
authored
Install latest Quarto 1.5 or higher, in case Quarto < 1.5.29 (#73)
1 parent ccf9abd commit 40cb2f0

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

action.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,23 @@ runs:
5959
run: |
6060
${GITHUB_ACTION_PATH}/dependencies.R
6161
[ ! -f "./template.qmd" ] && cp ${GITHUB_ACTION_PATH}/template.qmd . || echo "./template.qmd already exists"
62-
if [[ "$(echo -e "$(quarto --version)\n1.4.0" | sort -V | head -1)" == "1.4.0" ]]; then
63-
echo "✅ Quarto CLI version sufficient (>= 1.4.0)"
62+
MIN_QUARTO_VERSION="1.5.29"
63+
if [[ "$(echo -e "$(quarto --version)\n${MIN_QUARTO_VERSION}" | sort -V | head -1)" == "${MIN_QUARTO_VERSION}" ]]; then
64+
echo "✅ Quarto CLI version sufficient (>= ${MIN_QUARTO_VERSION})"
6465
echo "Quarto CLI version: $(quarto --version)"
6566
else
66-
echo "❌ Quarto CLI version insufficient (< 1.4.0)"
67-
echo "Downloading Quarto CLI..."
68-
# Install newer version of Quarto CLI.
69-
export QUARTO_VERSION="1.4.554"
67+
echo "❌ Quarto CLI version insufficient (< ${MIN_QUARTO_VERSION})"
7068
apt-get update
71-
apt-get install -qy wget
69+
apt-get install -qy wget jq
70+
# Install newer version of Quarto CLI.
71+
# This gets the latest version number (v1.5 up to v1.9) of Quarto from GitHub releases.
72+
# It assumes that such version number (v1.5 up to v1.9) exists within the last 100 released Quarto versions.
73+
export QUARTO_VERSION="$(curl -L -H "Accept: application/vnd.github+json" \
74+
-H "X-GitHub-Api-Version: 2022-11-28" \
75+
https://api.github.com/repos/quarto-dev/quarto-cli/releases?per_page=100 \
76+
2>/dev/null | \
77+
jq -r 'map(select(.tag_name | test("^v1.[5-9]"))) | .[0].name[1:]')"
78+
echo "Downloading and installing latest Quarto CLI version ${QUARTO_VERSION}"
7279
wget https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.deb
7380
dpkg -i quarto-${QUARTO_VERSION}-linux-amd64.deb
7481
echo "New Quarto CLI version: $(quarto --version)"

0 commit comments

Comments
 (0)