Skip to content

Commit 092cf7b

Browse files
authored
Remove gh dependency for Linux and MacOS when a version is specified (#8)
and fixes some WINDOWS bugs
2 parents 32c15b1 + 8ee1714 commit 092cf7b

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

install-quarto/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Install a Quarto release (https://github.com/quarto-dev/quarto-cli/releases) usi
77
This action will:
88

99
* 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)
10+
* On Windows, it will for now use **Scoop** (https://github.com/ScoopInstaller/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). (**Scoop** will be installed on the runner by the action)
11+
* On Linux and MacOS, it will use **gh** CLI to download the last available bundle (no `version` specified as input). If you don't have **gh** on your Github Action runner, you can specify a fix `version` to directly download from a URL using `wget`.
1112

1213
Inputs available
1314

install-quarto/action.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,35 @@ runs:
1313
# Select correct bundle for OS type
1414
case $RUNNER_OS in
1515
"Linux")
16-
echo "BUNDLE_EXT=deb" >> $GITHUB_ENV
16+
echo "BUNDLE_EXT=linux-amd64.deb" >> $GITHUB_ENV
1717
;;
1818
"macOS")
19-
echo "BUNDLE_EXT=pkg" >> $GITHUB_ENV
19+
echo "BUNDLE_EXT=macos.pkg" >> $GITHUB_ENV
2020
;;
2121
"Windows")
22-
echo "BUNDLE_EXT=msi" >> $GITHUB_ENV
22+
echo "BUNDLE_EXT=win.msi" >> $GITHUB_ENV
2323
;;
2424
*)
2525
echo "$RUNNER_OS not supported"
2626
exit 1
2727
;;
2828
esac
29-
# set version
30-
if [ ! -z "${{inputs.version}}" ]
31-
then
32-
echo "QUARTO_VERSION=v${{inputs.version}}" >> $GITHUB_ENV
33-
fi
3429
shell: bash
3530
- name: 'Download Quarto release'
3631
id: download-quarto
3732
env:
3833
GITHUB_TOKEN: ${{ github.token }}
3934
run: |
40-
# download the latest release
4135
if [ ${{ runner.os }} != "Windows" ]; then
42-
# On Windows scoop will be used so no need to download the release
43-
gh release download ${{env.QUARTO_VERSION}} --repo quarto-dev/quarto-cli --pattern ${{ format('*.{0}', env.BUNDLE_EXT) }}
44-
echo "::set-output name=installer::$(ls quarto*.$BUNDLE_EXT)"
36+
# On Windows scoop will be used so no need to download the release
37+
if [ -z "${{inputs.version}}" ]; then
38+
# download the latest release
39+
gh release download --repo quarto-dev/quarto-cli --pattern ${{ format('*{0}', env.BUNDLE_EXT) }}
40+
else
41+
# download a specific release
42+
wget https://github.com/quarto-dev/quarto-cli/releases/download/v${{inputs.version}}/quarto-${{inputs.version}}-${{env.BUNDLE_EXT}}
43+
fi
44+
echo "::set-output name=installer::$(ls quarto*${{ env.BUNDLE_EXT }})"
4545
fi
4646
shell: bash
4747
- name: 'Install Quarto'
@@ -57,11 +57,11 @@ runs:
5757
;;
5858
"Windows")
5959
# can't install msi for now so use scoop
60-
if [ -z "${{ env.QUARTO_VERSION }}" ]
60+
if [ -z "${{ inputs.version }}" ]
6161
then
6262
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1
6363
else
64-
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1 -version ${{ env.QUARTO_VERSION }}
64+
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1 ${{ inputs.version }}
6565
fi
6666
;;
6767
*)

install-quarto/install-quarto-windows.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
1818
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
1919

20-
param ($version)
20+
$version=$args[0]
2121
scoop bucket add r-bucket https://github.com/cderv/r-bucket.git
2222
if ([string]::IsNullOrEmpty($version)) {
2323
scoop install quarto

0 commit comments

Comments
 (0)