-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (49 loc) · 1.78 KB
/
main.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
name: Update China IP list
on:
workflow_dispatch:
# schedule:
# - cron: '0 4 * * *'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
name: Update GeoIP2 database
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: openssl
# Runs a single command using the runners shell
- name: Update GeoIP2 database
run: php ./main.php
- name: Push artifacts to release branch
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-action[bot]"
git fetch
git checkout release
git checkout --orphan release-orphan
git rm -rf .
cp -rf /tmp/CN_IP_list.txt ./
git add ./CN_IP_list.txt
git commit -am "Updated at $(date)"
git branch -D release
git branch -m release
- name: GitHub Push
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: release
force: true
- name: 刷新 CDN 缓存
#run: curl ${{ secrets.CDN_URL }}
run: curl purge.jsdelivr.net/gh/lwb1978/GeoIP2-CN@release/
- name: 删除旧的 workflow 运行记录
uses: GitRML/delete-workflow-runs@main
with:
retain_days: 30