forked from ygtsj/V2ray-IBM-LD
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (127 loc) · 3.68 KB
/
ibm-cf-v2.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: IBM Cloud Foundry - V2Ray
env:
IBM_CF_API: https://api.eu-gb.cf.cloud.ibm.com
IBM_CF_APP_MEM: 128M
on:
workflow_dispatch:
repository_dispatch:
schedule:
- cron: 0 21 * * *
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
IBM_CF_USERNAME: ${{ secrets.IBM_CF_USERNAME }}
IBM_CF_PASSWORD: ${{ secrets.IBM_CF_PASSWORD }}
IBM_CF_ORG_NAME: ${{ secrets.IBM_CF_ORG_NAME }}
IBM_CF_SPACE_NAME: ${{ secrets.IBM_CF_SPACE_NAME }}
IBM_CF_APP_NAME: ${{ secrets.IBM_CF_APP_NAME }}
V2_UUID: ${{ secrets.V2_UUID }}
V2_WS_PATH_VMESS: ${{ secrets.V2_WS_PATH_VMESS }}
V2_WS_PATH_VLESS: ${{ secrets.V2_WS_PATH_VLESS }}
steps:
- name: Install Cloud Foundry CLI
run: |
curl -fsSL "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=v7&source=github" | tar -zxC /tmp
sudo install -m 755 /tmp/cf7 /usr/local/bin/cf
cf version
- name: Login to IBM Cloud Foundry
run: |
cf login \
-a "${IBM_CF_API}" \
-u "${IBM_CF_USERNAME}" \
-p "${IBM_CF_PASSWORD}" \
-o "${IBM_CF_ORG_NAME:-$IBM_CF_USERNAME}" \
-s "${IBM_CF_SPACE_NAME:-dev}"
- name: Download Latest V2Ray
run: |
DOWNLOAD_URL="https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-64.zip"
curl -fsSL "$DOWNLOAD_URL" -o "latest-v2ray.zip"
unzip latest-v2ray.zip v2ray v2ctl geoip.dat geosite.dat
rm latest-v2ray.zip
chmod -v 755 v2*
./v2ray -version
mv v2ray ${IBM_CF_APP_NAME}
- name: Generate V2Ray Config File (VMess)
if: ${{ env.V2_WS_PATH_VMESS }}
run: |
base64 << 123 > config
{
"log": {
"access": "none",
"loglevel": "error"
},
"inbounds": [
{
"port": 8080,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "${V2_UUID}",
"alterId": 64
}
]
},
"streamSettings": {
"network":"ws",
"wsSettings": {
"path": "${V2_WS_PATH_VMESS}"
}
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}
- name: Generate V2Ray Config File (VLESS)
if: ${{ env.V2_WS_PATH_VLESS }}
run: |
base64 << 123 > config
{
"log": {
"access": "none",
"loglevel": "error"
},
"inbounds": [
{
"port": 8080,
"protocol": "vless",
"settings": {
"decryption": "none",
"clients": [
{
"id": "${V2_UUID}"
}
]
},
"streamSettings": {
"network":"ws",
"wsSettings": {
"path": "${V2_WS_PATH_VLESS}"
}
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}
- name: Generate Manifest File
run: |
cat << 123 > manifest.yml
applications:
- name: ${IBM_CF_APP_NAME}
memory: ${IBM_CF_APP_MEM}
random-route: true
command: base64 -d config > config.json; ./${IBM_CF_APP_NAME} -config=config.json
buildpacks:
- binary_buildpack
- name: Deploy Cloud Foundry App
run: cf push