This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
forked from michidk/run-komac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
78 lines (73 loc) · 2.71 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: 'Run Komac'
description: 'Sets up and runs Komac with optional customizations'
branding:
color: 'blue'
icon: 'upload-cloud'
inputs:
komac-version:
description: 'Komac version to use (default: latest)'
required: false
default: 'latest'
args:
description: 'Arguments to run Komac with'
required: true
custom-fork-owner:
description: 'Specify a custom fork owner of Komac, if any'
required: false
custom-tool:
description: 'Name of a custom tool to use with Komac'
required: false
custom-tool-url:
description: 'URL of the custom tool, if applicable'
required: false
runs:
using: 'composite'
steps:
- name: Check for Komac Installation
id: check_komac
shell: bash
run: |
if komac --version &> /dev/null; then
echo "Komac is already installed."
echo "komac_installed=true" >> $GITHUB_OUTPUT
else
echo "Komac is not installed."
echo "komac_installed=false" >> $GITHUB_OUTPUT
fi
- name: Install Komac
if: steps.check_komac.outputs.komac_installed == 'false'
shell: bash
run: |
version=${{ inputs.komac-version }}
if [ "$version" = "latest" ]; then
version=$(wget -qO- https://api.github.com/repos/russellbanks/Komac/releases/latest | grep 'tag_name' | cut -d'"' -f4 | sed 's/v//')
fi
if [ "$version" = "nightly" ]; then
wget https://github.com/russellbanks/Komac/releases/download/nightly/komac-nightly-x86_64-unknown-linux-gnu.tar.gz -O komac.tar.gz
else
wget https://github.com/russellbanks/Komac/releases/download/v$version/KomacPortable-linux-x64.tar.gz -O komac.tar.gz
fi
tar -xzf komac.tar.gz && rm komac.tar.gz
mkdir -p $HOME/.local/bin
if [ "$version" = "nightly" ]; then
mv komac $HOME/.local/bin/komac
else
mv KomacPortable-linux-x64 $HOME/.local/bin/komac
fi
chmod +x $HOME/.local/bin/komac
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set Custom Environment Variables
shell: bash
run: |
if [[ -n "${{ inputs.custom-fork-owner }}" ]]; then
echo "KOMAC_FORK_OWNER=${{ inputs.custom-fork-owner }}" >> $GITHUB_ENV
fi
if [[ -n "${{ inputs.custom-tool }}" ]]; then
echo "KOMAC_CREATED_WITH=${{ inputs.custom-tool }}" >> $GITHUB_ENV
fi
if [[ -n "${{ inputs.custom-tool-url }}" ]]; then
echo "KOMAC_CREATED_WITH_URL=${{ inputs.custom-tool-url }}" >> $GITHUB_ENV
fi
- name: Run Komac
shell: bash
run: $HOME/.local/bin/komac ${{ inputs.args }}