forked from wangsijie/setup-v2ray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
43 lines (43 loc) · 1.37 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
name: Setup v2ray
description: install v2ray and run it in background
inputs:
config:
description: "config.json"
required: true
version:
description: "version number of v2ray"
required: false
default: "latest"
runs:
using: "composite"
steps:
- name: download v2ray
shell: bash
run: |
mkdir -p .v2ray
cd .v2ray
if [ "${{ inputs.version }}" = "latest" ]; then
wget -q https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-64.zip{,.dgst}
else
wget -q https://github.com/v2fly/v2ray-core/releases/download/v${{ inputs.version }}/v2ray-linux-64.zip{,.dgst}
fi
grep SHA2-256 v2ray-linux-64.zip.dgst | awk '{print $2, " v2ray-linux-64.zip"}' | sha256sum -c -
unzip v2ray-linux-64.zip
chmod +x v2ray
rm -f v2ray-linux-64.zip{,.dgst}
- name: write config file
shell: bash
run: |
cat > .v2ray/config.json << "EOF"
${{ inputs.config }}
EOF
- name: start v2ray
shell: bash
run: |
if [ "${{ inputs.version }}" = "latest" ]; then
.v2ray/v2ray run -c .v2ray/config.json &
elif [ "$(echo "${{ inputs.version }}" | awk -F'.' '{print $1}')" -ge 5 ]; then
.v2ray/v2ray run -c .v2ray/config.json &
else
.v2ray/v2ray --config=.v2ray/config.json &
fi