forked from gi0baro/setup-noir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
56 lines (49 loc) · 1.73 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
49
50
51
52
53
54
55
56
name: Setup noir
author: Giovanni Barillari <[email protected]>
description: Installs noir
branding:
icon: package
color: blue
inputs:
version:
description: "Version to install. (default: latest)"
required: false
default: latest
runs:
using: composite
steps:
- run: echo ${{ runner.arch }}
shell: bash
- name: Install noir
run: |
set -eou pipefail
if [ "${{ runner.os }}" == "Windows" ]; then
_target_arch=windows-x86_64
elif [ "${{ runner.os }}" == "macOS" ]; then
_target_arch=darwin-x86_64
elif [ "${{ runner.arch }}" == "ARM64" ]; then
_target_arch=linux-aarch64
else
_target_arch=linux-x86_64
fi
if [ "${{ runner.os }}" == "Windows" ]; then
path="C:/Users/runneradmin/AppData/Roaming/Noir"
else
path="$HOME/.local/noir"
fi
echo -e "\n\033[33mSetting noir installation path as: $path\033[0m\n"
mkdir -p $path
if [ "${{ inputs.version }}" == "latest" ]; then
_release=$(curl -sSL -H 'Authorization: Bearer ${{ github.token }}' https://api.github.com/repos/gi0baro/noir/releases/latest)
_version=$(echo "$_release" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
else
_version=${{ inputs.version }}
fi
echo -e "\033[33mInstalling noir $_version\033[0m\n"
_archive=$(mktemp)
curl -sSL https://github.com/gi0baro/noir/releases/download/$_version/noir-$_version-$_target_arch.tar.gz > $_archive
tar xzf $_archive --directory $path
echo "$path" >> $GITHUB_PATH
export PATH="$path:$PATH"
echo -e "\n\033[33mInstalled noir successfully ✅\033[0m"
shell: bash