forked from zhiyi7/gfw-pac
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (42 loc) · 1.31 KB
/
main.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
name: Auto Build PAC
on:
workflow_dispatch:
schedule:
- cron: '51 3 * * *'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Build
run: |
curl -o delegated-apnic-latest.txt https://ftp.apnic.net/stats/apnic/delegated-apnic-latest
./gfw-pac.py -f gfw.pac \
-p "PROXY 127.0.0.1:6565; DIRECT" \
--user-rule=custom-domains.txt \
--direct-rule=direct-domains.txt \
--localtld-rule=local-tlds.txt \
--ip-file=delegated-apnic-latest.txt
git add .
- name: Set up SSH keys
run: |
mkdir ~/.ssh
git config --global user.email "[email protected]"
git config --global user.name "Dark495Bot"
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
- name: Pull latest changes from the remote repo
run: git pull -f origin $GITHUB_REF
- name: Commit and push changes
run: |
if [[ $(git status -s | wc -l) -gt 0 ]]; then
git commit -m "Auto Update at $(date "+%Y-%m-%d %T")";
git push origin HEAD:$GITHUB_REF;
fi