forked from dyingsunlight/free-rider
-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (43 loc) · 1.89 KB
/
tailscale+v2ray.yaml
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
name: Tailscale+V2ray
# 注意事项:
# 1. 应当指定每个任务的持续时间和开始时间,例如设置 schedule.cron 属性让任务每个小时自动运行一次,每次运行时间 60分钟 (由 "Start V2ray" 中的 timeout-minutes 指定)
# 2. 应当确保 IP_ASSIGNMENT
on:
workflow_dispatch:
# 取消注释以启用定时任务(默认每小时),具体生成可参考 https://www.freeformatter.com/cron-expression-generator-quartz.html
# schedule:
# - cron: "0 0 * ? * *"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Tailscale
run: |
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.gpg | sudo apt-key add -
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update
sudo apt-get install tailscale
- name: Start Tailscale
env:
# 如果修改了 IP_ASSIGNMENT,那么对于 clash 配置的服务器地址也应当同步。
IP_ASSIGNMENT: 10.144.254.254
TAILSCALE_TOKEN: ${{ secrets.TAILSCALE_TOKEN }}
run: |
sudo tailscale login --authkey=$TAILSCALE_TOKEN
sudo tailscale up
sudo tailscale set --hostname="$IP_ASSIGNMENT"
- name: Start V2ray
# 每次运行时间 60分钟
timeout-minutes: 60
env:
V2RAY_CONFIG_JSON: ${{ secrets.V2RAY_CONFIG_JSON }}
run: |
echo $V2RAY_CONFIG_JSON > v2ray-runtime-config.json
docker run --network=host --name v2ray -v ${{ github.workspace }}/v2ray-runtime-config.json:/etc/v2fly/config.json -p 10086:10086 v2fly/v2fly-core run -c /etc/v2fly/config.json
- name: Immediately Cleanup
if: always()
run: |
echo "Immediately Cleanup"
sudo tailscale logout