Skip to content

Commit 32c15b1

Browse files
authored
Allow to specify a quarto version (#7)
2 parents 0fa7322 + 0ed8d71 commit 32c15b1

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

install-quarto/README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
# install-quarto
22

3-
Install last Quarto release (https://github.com/quarto-dev/quarto-cli/releases) using GitHub Actions. This action can be used to install Quarto on all runner OS and `quarto` will be available from PATH.
3+
Install a Quarto release (https://github.com/quarto-dev/quarto-cli/releases) using GitHub Actions. This action can be used to install Quarto on all runner OS and `quarto` will be available from PATH
44

55
## Usage
66

7+
This action will:
8+
9+
* Download the Github Release of Quarto on Mac and Linux and install it
10+
* On Windows, it will for now use Scoop to install Quarto, as we have still an issue with Quarto MSI on Github Action (https://github.com/quarto-dev/quarto-cli/issues/108)
11+
12+
Inputs available
13+
14+
* `version` - _optional_. If provided, the specific quarto version will be installed. Ex: `version: 0.3.71`
15+
**Only available on `main` branch**
16+
17+
```yaml
18+
steps:
19+
- uses: quarto-dev/quarto-actions/install-quarto@main
20+
with:
21+
version: 0.3.71
22+
```
23+
724
Example on different OS:
825
926
```yaml
@@ -33,7 +50,3 @@ jobs:
3350
quarto --version
3451
```
3552
36-
This action will
37-
38-
* Download the Github Release of quarto on Mac and Linux and install it
39-
* On Windows, it will for now use Scoop to install Quarto msi, until Quarto MSI file can be installed on Github Action (https://github.com/quarto-dev/quarto-cli/issues/108)

install-quarto/action.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: 'Install Quarto'
22
author: 'Christophe Dervieux'
33
description: 'This actions will install Quarto binary from https://github.com/quarto-dev/quarto-cli/'
4+
inputs:
5+
version:
6+
description: 'The version of Quarto CLI to install, as a release tag (https://github.com/quarto-dev/quarto-cli/releases). Ex: 0.3.73'
7+
required: false
48
runs:
59
using: 'composite'
610
steps:
@@ -22,6 +26,11 @@ runs:
2226
exit 1
2327
;;
2428
esac
29+
# set version
30+
if [ ! -z "${{inputs.version}}" ]
31+
then
32+
echo "QUARTO_VERSION=v${{inputs.version}}" >> $GITHUB_ENV
33+
fi
2534
shell: bash
2635
- name: 'Download Quarto release'
2736
id: download-quarto
@@ -31,7 +40,7 @@ runs:
3140
# download the latest release
3241
if [ ${{ runner.os }} != "Windows" ]; then
3342
# On Windows scoop will be used so no need to download the release
34-
gh release download --repo quarto-dev/quarto-cli --pattern ${{ format('*.{0}', env.BUNDLE_EXT) }}
43+
gh release download ${{env.QUARTO_VERSION}} --repo quarto-dev/quarto-cli --pattern ${{ format('*.{0}', env.BUNDLE_EXT) }}
3544
echo "::set-output name=installer::$(ls quarto*.$BUNDLE_EXT)"
3645
fi
3746
shell: bash
@@ -48,7 +57,12 @@ runs:
4857
;;
4958
"Windows")
5059
# can't install msi for now so use scoop
51-
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1
60+
if [ -z "${{ env.QUARTO_VERSION }}" ]
61+
then
62+
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1
63+
else
64+
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1 -version ${{ env.QUARTO_VERSION }}
65+
fi
5266
;;
5367
*)
5468
echo "$RUNNER_OS not supported"

install-quarto/install-quarto-windows.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,11 @@
1616

1717
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
1818
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
19+
20+
param ($version)
1921
scoop bucket add r-bucket https://github.com/cderv/r-bucket.git
20-
scoop install quarto
22+
if ([string]::IsNullOrEmpty($version)) {
23+
scoop install quarto
24+
}else{
25+
Invoke-Expression -Command "scoop install quarto@$version"
26+
}

0 commit comments

Comments
 (0)