|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | +# 配置参考 https://github.com/alanbobs999/TopFreeProxies |
| 3 | + |
| 4 | +name: Auto update |
| 5 | + |
| 6 | +# Controls when the workflow will run |
| 7 | + |
| 8 | +on: |
| 9 | + schedule: |
| 10 | + # Executed at 5:00, 13:00, 21:00 o'clock every day |
| 11 | + # 表达式生成 https://crontab.guru/ |
| 12 | + - cron: '0 5,13,21 * * *' |
| 13 | + |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +jobs: |
| 17 | + auto_update: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v2 |
| 22 | + - name: Python |
| 23 | + uses: actions/setup-python@v2 |
| 24 | + with: |
| 25 | + python-version: '3.10' |
| 26 | + - name: Cache |
| 27 | + uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: ~/.cache/pip |
| 30 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/run_in_Actions/requirements') }} |
| 31 | + restore-keys: | |
| 32 | + ${{ runner.os }}-pip- |
| 33 | + - name: Timezone |
| 34 | + run: sudo timedatectl set-timezone 'Asia/Shanghai' |
| 35 | + - name: Requirements |
| 36 | + run: | |
| 37 | + pip install -r ./utils/requirements |
| 38 | + - name: SubMerge |
| 39 | + run: | |
| 40 | + wget -O subconverter.tar.gz https://github.com/tindy2013/subconverter/releases/latest/download/subconverter_linux64.tar.gz |
| 41 | + tar -zxvf subconverter.tar.gz -C ./ |
| 42 | + chmod +x ./subconverter/subconverter && nohup ./subconverter/subconverter >./subconverter.log 2>&1 & |
| 43 | + python ./utils/sub_merge.py |
| 44 | + - name: GitMerge |
| 45 | + run: | |
| 46 | + git config --local user.email "actions@github.com" |
| 47 | + git config --local user.name "GitHub Actions" |
| 48 | + git pull origin master |
| 49 | + git add v2ray |
| 50 | + git add clash.yaml |
| 51 | + git commit -m "merge: $(date '+%Y-%m-%d %H:%M:%S') 合并节点" |
| 52 | + - name: Push |
| 53 | + uses: ad-m/github-push-action@master |
| 54 | + with: |
| 55 | + branch: master |
| 56 | + - name: GitCommit |
| 57 | + run: | |
| 58 | + git pull origin master |
| 59 | + git add list.json |
| 60 | + (git commit -m "update: $(date '+%Y-%m-%d %H:%M:%S') 更新链接") || true |
| 61 | + - name: GitPush |
| 62 | + uses: ad-m/github-push-action@master |
| 63 | + with: |
| 64 | + branch: master |
| 65 | + |
| 66 | + update_branch: |
| 67 | + needs: [auto_update] |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - name: Checkout |
| 71 | + uses: actions/checkout@v2 |
| 72 | + - name: UpdateBranch |
| 73 | + run: | |
| 74 | + git config --local user.email "actions@github.com" |
| 75 | + git config --local user.name "GitHub Actions" |
| 76 | + git pull origin master |
| 77 | + git checkout --orphan latest_branch |
| 78 | + git add -A |
| 79 | + git commit -am "update: $(date '+%Y-%m-%d %H:%M:%S')" |
| 80 | + git branch -D master |
| 81 | + git branch -m master |
| 82 | + git push -f origin master |
0 commit comments