-
Notifications
You must be signed in to change notification settings - Fork 20
113 lines (92 loc) · 3.32 KB
/
subscribe.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
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
name: subscribe update
on:
# push:
# branches: [ "main" ]
schedule:
- cron: '07 */8 * * *'
workflow_dispatch:
inputs:
bin_flag:
type: string
required: true
env:
TMP_BUILD_DIR: ${{ github.workspace }}/orepo/v2speed/target/release
RUN_FLAG: "${{ github.event.inputs.bin_flag || '' }}"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# - name: setup rust and go
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-go@v5
with:
go-version: '>=1.19.0'
- run: |
rustc --version
go version
- name: make env
run: |
git --version
mkdir orepo
cd orepo
echo "archive=$(echo "zip")" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
repository: 'ts-sf/v2tool'
path: '${{ github.workspace }}/orepo/v2tool'
ref: 'dev'
- uses: actions/checkout@v4
with:
repository: '${{ secrets.ROMOTE_REPO }}'
token: '${{ secrets.PERSONAL_TOKEN }}'
path: '${{ github.workspace }}/orepo/v2speed'
- name: build
run: |
cd ${{ github.workspace }}/orepo/v2tool
# ls
# $bin = "${{ github.workspace }}/target/release"
go mod tidy
go build -o ${{ env.TMP_BUILD_DIR }}/v2tool
cd ${{ github.workspace }}/orepo/v2speed
cargo build --release
chmod 777 run.sh
mv run.sh ${{ env.TMP_BUILD_DIR }}
- name: run
run: |
cd ${{ env.TMP_BUILD_DIR }}
./run.sh ${{ env.RUN_FLAG }}
[ -f ${{ env.TMP_BUILD_DIR }}/out.png ] && mv ${{ env.TMP_BUILD_DIR }}/out.png ${{ github.workspace }}/traffic.png
[ -e ${{ github.workspace }}/addition ] && rm -rf ${{ github.workspace }}/addition
[ -f ${{ github.workspace }}/v2 ] && rm ${{ github.workspace }}/v2*
[ -f ${{ github.workspace }}/clash ] && rm ${{ github.workspace }}/clash*
mv ${{ env.TMP_BUILD_DIR }}/data/main/* ${{ github.workspace }}/
- name: commit changes
run: |
cd ${{ github.workspace }}
git config user.email "[email protected]"
git config user.name "Github Actions"
git add .
git commit -m "🚀 $(date -d '-8 hours ago' "+%Y-%m-%d %H:%M:%S")"
- name: push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PERSONAL_TOKEN }}
- name: checkout speed
uses: actions/checkout@v4
with:
ref: speed
path: 'orepo/speed'
- name: commit and push speed
run: |
cd ${{ github.workspace }}/orepo/speed
[ -f v2 ] && rm v2*
[ -f clash ] && rm clash*
[ -f README.md ] && rm README.md
[ -e addition ] && rm -rf addition
mv ${{ env.TMP_BUILD_DIR }}/data/speed/* ${{ github.workspace }}/orepo/speed/
git config user.email "[email protected]"
git config user.name "Github Actions"
git add .
git commit -m "♻ $(date -d '-8 hours ago' "+%Y-%m-%d %H:%M:%S")"
git push https://${{secrets.PERSONAL_TOKEN}}@github.com/ts-sf/fly.git speed