Skip to content

Commit

Permalink
Install latest Quarto 1.5 or higher, in case Quarto < 1.5.29 (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif authored May 21, 2024
1 parent ccf9abd commit 40cb2f0
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,23 @@ runs:
run: |
${GITHUB_ACTION_PATH}/dependencies.R
[ ! -f "./template.qmd" ] && cp ${GITHUB_ACTION_PATH}/template.qmd . || echo "./template.qmd already exists"
if [[ "$(echo -e "$(quarto --version)\n1.4.0" | sort -V | head -1)" == "1.4.0" ]]; then
echo "✅ Quarto CLI version sufficient (>= 1.4.0)"
MIN_QUARTO_VERSION="1.5.29"
if [[ "$(echo -e "$(quarto --version)\n${MIN_QUARTO_VERSION}" | sort -V | head -1)" == "${MIN_QUARTO_VERSION}" ]]; then
echo "✅ Quarto CLI version sufficient (>= ${MIN_QUARTO_VERSION})"
echo "Quarto CLI version: $(quarto --version)"
else
echo "❌ Quarto CLI version insufficient (< 1.4.0)"
echo "Downloading Quarto CLI..."
# Install newer version of Quarto CLI.
export QUARTO_VERSION="1.4.554"
echo "❌ Quarto CLI version insufficient (< ${MIN_QUARTO_VERSION})"
apt-get update
apt-get install -qy wget
apt-get install -qy wget jq
# Install newer version of Quarto CLI.
# This gets the latest version number (v1.5 up to v1.9) of Quarto from GitHub releases.
# It assumes that such version number (v1.5 up to v1.9) exists within the last 100 released Quarto versions.
export QUARTO_VERSION="$(curl -L -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/quarto-dev/quarto-cli/releases?per_page=100 \
2>/dev/null | \
jq -r 'map(select(.tag_name | test("^v1.[5-9]"))) | .[0].name[1:]')"
echo "Downloading and installing latest Quarto CLI version ${QUARTO_VERSION}"
wget https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.deb
dpkg -i quarto-${QUARTO_VERSION}-linux-amd64.deb
echo "New Quarto CLI version: $(quarto --version)"
Expand Down

0 comments on commit 40cb2f0

Please sign in to comment.