Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove gh dependency for Linux and MacOS when a version is specified #8

Merged
merged 7 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion install-quarto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Install a Quarto release (https://github.com/quarto-dev/quarto-cli/releases) usi
This action will:

* Download the Github Release of Quarto on Mac and Linux and install it
* 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)
* 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)
* 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`.

Inputs available

Expand Down
28 changes: 14 additions & 14 deletions install-quarto/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,35 @@ runs:
# Select correct bundle for OS type
case $RUNNER_OS in
"Linux")
echo "BUNDLE_EXT=deb" >> $GITHUB_ENV
echo "BUNDLE_EXT=linux-amd64.deb" >> $GITHUB_ENV
;;
"macOS")
echo "BUNDLE_EXT=pkg" >> $GITHUB_ENV
echo "BUNDLE_EXT=macos.pkg" >> $GITHUB_ENV
;;
"Windows")
echo "BUNDLE_EXT=msi" >> $GITHUB_ENV
echo "BUNDLE_EXT=win.msi" >> $GITHUB_ENV
;;
*)
echo "$RUNNER_OS not supported"
exit 1
;;
esac
# set version
if [ ! -z "${{inputs.version}}" ]
then
echo "QUARTO_VERSION=v${{inputs.version}}" >> $GITHUB_ENV
fi
shell: bash
- name: 'Download Quarto release'
id: download-quarto
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
# download the latest release
if [ ${{ runner.os }} != "Windows" ]; then
# On Windows scoop will be used so no need to download the release
gh release download ${{env.QUARTO_VERSION}} --repo quarto-dev/quarto-cli --pattern ${{ format('*.{0}', env.BUNDLE_EXT) }}
echo "::set-output name=installer::$(ls quarto*.$BUNDLE_EXT)"
# On Windows scoop will be used so no need to download the release
if [ -z "${{inputs.version}}" ]; then
# download the latest release
gh release download --repo quarto-dev/quarto-cli --pattern ${{ format('*{0}', env.BUNDLE_EXT) }}
else
# download a specific release
wget https://github.com/quarto-dev/quarto-cli/releases/download/v${{inputs.version}}/quarto-${{inputs.version}}-${{env.BUNDLE_EXT}}
fi
echo "::set-output name=installer::$(ls quarto*${{ env.BUNDLE_EXT }})"
fi
shell: bash
- name: 'Install Quarto'
Expand All @@ -57,11 +57,11 @@ runs:
;;
"Windows")
# can't install msi for now so use scoop
if [ -z "${{ env.QUARTO_VERSION }}" ]
if [ -z "${{ inputs.version }}" ]
then
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1
else
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1 -version ${{ env.QUARTO_VERSION }}
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1 ${{ inputs.version }}
fi
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion install-quarto/install-quarto-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH

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