forked from typecho-fans/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.5 KB
/
sync-mirrors.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
46
47
48
49
50
51
52
53
54
55
# 同步数据至Gitee/jsDelivr等加速地址供TeStore调用
name: "更新Action后同步镜像"
on:
workflow_run:
workflows:
- "手动更新单GitHub插件"
- "定时更新全GitHub插件"
- "推送更新变动插件zip包"
branches:
- "master"
types:
- completed
jobs:
dispatch-mirror:
name: "同步API和Gitee目录"
runs-on: "ubuntu-latest"
steps:
- name: "获取执行后时间戳"
id: "get-update"
run: |
stamp=`date +%s`
echo "::set-output name=upDate::$stamp"
- uses: actions/checkout@v2
- name: "获取ZIP_CDN计数"
id: "get-total"
working-directory: ZIP_CDN
run: |
count=`git ls-files | wc -l`
echo "::set-output name=toTal::$count"
- name: "触发API目录更新"
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.API_MIRROR }}
repository: jzwalk/API_Mirror
event-type: sync
# 传递两项数据参数
client-payload: '{"total": "${{ steps.get-total.outputs.toTal }}", "update": "${{ steps.get-update.outputs.upDate }}"}'
- name: "推送Gitee镜像同步"
uses: Yikun/hub-mirror-action@master
with:
src: github/typecho-fans
dst: gitee/typecho-fans
dst_key: ${{ secrets.SYNC_PV }}
dst_token: ${{ secrets.GITEE_TOKEN }}
account_type: org
static_list: "plugins"
force_update: true