-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
80 lines (66 loc) · 2.1 KB
/
action.yaml
File metadata and controls
80 lines (66 loc) · 2.1 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
name: Setup gah
description: GitHub Action that setups gah
author: marverix
branding:
icon: package
color: yellow
inputs:
version:
description: gah version to install
default: latest
runs:
using: composite
steps:
- name: Check valid OS
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
Write-Host "::error title=OS Not Supported::gah does not support Windows OS."
exit 1
- name: Check pre-requisites
shell: bash
run: |
if [ "${BASH_VERSINFO[0]}" -lt 4 ]; then
echo "::error title=Pre-requisite failed::Bash 4.0 or higher is required"
exit 1
fi
required_commands=(tar unzip curl jq)
for cmd in "${required_commands[@]}"; do
if ! command -v "$cmd" &> /dev/null; then
echo "::error title=Pre-requisite failed::$cmd is not installed"
exit 1
fi
done
- name: Check version
id: version
shell: bash
env:
TAG: ${{ inputs.version }}
run: |
if [ "$TAG" == "latest" ]; then
TAG=$(curl -s https://api.github.com/repos/marverix/gah/releases/latest | jq -r '.tag_name')
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Prepare environment
shell: bash
env:
ACTION_PATH: ${{ github.action_path }}
run: |
echo "UNATTENDED=true" >> $GITHUB_ENV
GAH_CACHE_DIR="$ACTION_PATH/.cache"
echo "GAH_CACHE_DIR=$GAH_CACHE_DIR" >> $GITHUB_ENV
mkdir -p "$GAH_CACHE_DIR"
GAH_INSTALL_DIR="$ACTION_PATH/.bin"
echo "GAH_INSTALL_DIR=$GAH_INSTALL_DIR" >> $GITHUB_ENV
mkdir -p "$GAH_INSTALL_DIR"
echo "PATH=$GAH_INSTALL_DIR:$PATH" >> $GITHUB_ENV
if [[ -n "$RUNNER_DEBUG" ]]; then
echo "GAH_DEBUG=true" >> $GITHUB_ENV
fi
- name: Download gah
shell: bash
env:
TAG: ${{ steps.version.outputs.tag }}
run: |
curl -sL --fail-with-body https://raw.githubusercontent.com/marverix/gah/refs/tags/${TAG}/gah -o "$GAH_INSTALL_DIR/gah"
chmod +x "$GAH_INSTALL_DIR/gah"