-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathaction.yml
More file actions
138 lines (138 loc) · 5.14 KB
/
action.yml
File metadata and controls
138 lines (138 loc) · 5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: 'Setup Quarto'
author: 'Christophe Dervieux'
description: 'This action will setup Quarto from the git repository https://github.com/quarto-dev/quarto-cli/'
inputs:
version:
description: 'The version of Quarto to use. Either a release tag without "v" prefix (e.g., "0.9.486"), "pre-release" for latest built dev version, or "release", for the latest stable version.'
required: false
default: 'release'
tinytex:
description: 'If true, install TinyTex, required for PDF rendering'
required: false
default: 'false'
outputs:
version:
description: 'The installed version of quarto.'
runs:
using: 'composite'
steps:
- name: 'Choose which binary to use'
run: |
# Select correct bundle for OS type
case $RUNNER_OS in
"Linux")
case $RUNNER_ARCH in
ARM64|ARM)
echo "BUNDLE_EXT=linux-arm64.deb" >> $GITHUB_ENV
;;
*)
echo "BUNDLE_EXT=linux-amd64.deb" >> $GITHUB_ENV
;;
esac
;;
"macOS")
echo "BUNDLE_EXT=macos.pkg" >> $GITHUB_ENV
;;
"Windows")
echo "BUNDLE_EXT=win.msi" >> $GITHUB_ENV
;;
*)
echo "$RUNNER_OS not supported"
exit 1
;;
esac
shell: bash
working-directory: ${{ runner.temp }}
- name: 'Download Quarto'
id: download-quarto
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
if [ ${{ runner.os }} != "Windows" ]; then
# On Windows scoop will be used so no need to download the release
if [ "${{inputs.version}}" == "release" ]; then
# download the latest stable release
version=$(curl https://quarto.org/docs/download/_download.json | jq -r '.version')
wget https://github.com/quarto-dev/quarto-cli/releases/download/v$version/quarto-$version-${{env.BUNDLE_EXT}}
echo "version=${version}" >> $GITHUB_OUTPUT
elif [ "${{inputs.version}}" == "LATEST" -o "${{inputs.version}}" == "pre-release" ]; then
# get latest pre release version
version=$(curl https://quarto.org/docs/download/_prerelease.json | jq -r '.version')
wget https://github.com/quarto-dev/quarto-cli/releases/download/v$version/quarto-$version-${{env.BUNDLE_EXT}}
echo "version=${version}" >> $GITHUB_OUTPUT
else
# download a specific release
wget https://github.com/quarto-dev/quarto-cli/releases/download/v${{inputs.version}}/quarto-${{inputs.version}}-${{env.BUNDLE_EXT}}
echo "version=${{inputs.version}}" >> $GITHUB_OUTPUT
fi
echo "installer=$(ls quarto*${{ env.BUNDLE_EXT }})" >> $GITHUB_OUTPUT
else
: # do nothing for now (https://github.com/quarto-dev/quarto-actions/issues/59 :facepalm:)
# FIXME: how to get version information from scoop in windows runners?
# send the cderv bat-signal!
fi
shell: bash
working-directory: ${{ runner.temp }}
- name: 'Install Quarto'
run: |
# Install quarto
[ ${{ runner.os }} != "Windows" ] && installer=${{ steps.download-quarto.outputs.installer }}
case $RUNNER_OS in
"Linux")
sudo apt -y install ./$installer
;;
"macOS")
sudo installer -pkg ./$installer -target '/'
;;
"Windows")
# can't install msi for now so use scoop
if [ "${{inputs.version}}" == "release" ]
then
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1
else
powershell -File $GITHUB_ACTION_PATH/install-quarto-windows.ps1 ${{ inputs.version }}
fi
;;
*)
echo "$RUNNER_OS not supported"
exit 1
;;
esac
if [ "${{ runner.os }}" != "Windows" ]; then
rm $installer
fi
shell: bash
working-directory: ${{ runner.temp }}
- name: 'Verify Quarto installation'
run: |
if ! command -v quarto &> /dev/null; then
echo "ERROR: Quarto installation completed but quarto command not found"
exit 1
fi
echo "Quarto Installed !"
quarto --version
shell: bash
- name: 'Install TinyTeX'
env:
QUARTO_PRINT_STACK: true
if: ${{ inputs.tinytex == 'true'}}
run: |
quarto install tool tinytex --no-prompt --log-level warning
case $RUNNER_OS in
"Linux")
echo "$HOME/bin" >> $GITHUB_PATH
;;
"macOS")
echo "$(dirname $(find ~/Library/TinyTeX -name tlmgr))" >> $GITHUB_PATH
;;
"Windows")
echo "$(dirname $(find $APPDATA/TinyTeX -name tlmgr.bat))" >> $GITHUB_PATH
;;
*)
echo "$RUNNER_OS not supported"
exit 1
;;
esac
echo "TinyTeX installed !"
shell: bash
working-directory: ${{ runner.temp }}