-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
48 lines (45 loc) · 1.8 KB
/
action.yml
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
name: 'Install dfx'
description: 'Install the dfx utility at a particular version'
inputs:
dfx-version:
description: >
The dfx version to install. This value will be used to populate
the DFX_VERSION variable that will be handled by the installation
script "install.sh".
If "latest" is provided, the latest version will be installed.
If "auto" is provided, the version will be taken from the "dfx" field in dfx.json if it exists; otherwise as if "latest".
default: 'auto'
runs:
using: composite
steps:
- name: Install dfx
shell: sh
env:
DFXVM_INIT_YES: 'true'
run: |
if [ "${{ inputs.dfx-version }}" = "latest" ]; then
export DFX_VERSION=""
elif [ "${{ inputs.dfx-version }}" = "auto" ]; then
export DFX_VERSION="$(jq -er '.dfx // ""' dfx.json || echo "")"
else
export DFX_VERSION="${{ inputs.dfx-version }}"
fi
echo "DFX_VERSION is $DFX_VERSION"
# Retry up to 10 times. Each attempt has 20 seconds total to complete, 5 seconds of which is to connect.
# This uses the default retry delay, which starts at 1s and doubles each time, up to 10 min.
if install_script=$(curl --fail --silent --show-error --location --retry 10 --connect-timeout 5 --max-time 20 --retry-connrefused https://internetcomputer.org/install.sh); then
sh -c "$install_script"
else
echo "Failed to download install script."
exit 1
fi
- name: Set up path (linux)
shell: sh
if: runner.os == 'Linux'
run: |
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
- name: Set up path (macos)
shell: sh
if: runner.os == 'macOS'
run: |
echo "$HOME/Library/Application Support/org.dfinity.dfx/bin" >> $GITHUB_PATH