Skip to content

Commit cf850a5

Browse files
committed
Add install-quarto action
1 parent 5fdce86 commit cf850a5

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

install-quarto/action.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: 'Install Quarto'
2+
author: 'Christophe Dervieux'
3+
description: 'This actions will install Quarto binary from https://github.com/quarto-dev/quarto-cli/'
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: 'Select binary for OS'
8+
run: |
9+
# Select correct bundle for OS type
10+
case $RUNNER_OS in
11+
"Linux")
12+
echo "BUNDLE_EXT=deb" >> $GITHUB_ENV
13+
;;
14+
"macOS")
15+
echo "BUNDLE_EXT=pkg" >> $GITHUB_ENV
16+
;;
17+
"Windows")
18+
echo "BUNDLE_EXT=msi" >> $GITHUB_ENV
19+
;;
20+
*)
21+
echo "$RUNNER_OS not supported"
22+
exit 1
23+
;;
24+
esac
25+
shell: bash
26+
- name: 'Download Quarto release'
27+
id: download-quarto
28+
env:
29+
GITHUB_TOKEN: ${{ github.token }}
30+
run: |
31+
# download the latest release
32+
if [ ${{ runner.os }} != "Windows" ]; then
33+
# 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) }}
35+
echo "::set-output name=installer::$(ls quarto*.$BUNDLE_EXT)"
36+
fi
37+
shell: bash
38+
- name: 'Install Quarto'
39+
run: |
40+
# Install quarto
41+
[ ${{ runner.os }} != "Windows" ] && installer=${{ steps.download-quarto.outputs.installer }}
42+
case $RUNNER_OS in
43+
"Linux")
44+
sudo apt install ./$installer
45+
;;
46+
"macOS")
47+
sudo installer -pkg ./$installer -target '/'
48+
;;
49+
"Windows")
50+
# can't install msi for now so use scoop
51+
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1
52+
;;
53+
*)
54+
echo "$RUNNER_OS not supported"
55+
exit 1
56+
;;
57+
esac
58+
[ ${{ runner.os }} != "Windows" ] && rm $installer
59+
echo "Quarto Installed !"
60+
shell: bash
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<#
2+
.Synopsis
3+
Install Quarto release through Scoop package manager
4+
.Description
5+
Install Scoop then add r-bucket, and install Quarto from there.
6+
.Example
7+
install-quarto-windows.ps1
8+
.Notes
9+
On Windows, it may be required to enable this Activate.ps1 script by setting the
10+
execution policy for the user. You can do this by issuing the following PowerShell
11+
command:
12+
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
13+
For more information on Execution Policies:
14+
ttps:/go.microsoft.com/fwlink/?LinkID=135170
15+
#>
16+
17+
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
18+
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
19+
scoop bucket add r-bucket https://github.com/cderv/r-bucket.git
20+
scoop install quarto

0 commit comments

Comments
 (0)