-
Notifications
You must be signed in to change notification settings - Fork 9
124 lines (109 loc) · 4.88 KB
/
update-dashboard.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
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
114
115
116
117
118
119
120
121
122
123
124
name: Update Dashboard
on:
workflow_dispatch:
schedule:
- cron: "30 17 * * *"
push:
branches:
- main
paths-ignore:
- "README.md"
- ".github/workflows/delete-old-workflows.yml"
- ".github/workflows/update-adguardhome.yml"
- ".github/workflows/update-mihomo.yml"
- ".github/workflows/update-singbox.yml"
jobs:
Update:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@main
- name: Checkout `yacd`
uses: actions/checkout@v4
with:
repository: haishanh/yacd
fetch-depth: 0
- name: Get `yacd` version and time
run: |
yacd_version=$(git describe --tags --abbrev=0 HEAD)
echo "yacd_version=$yacd_version" >> ${GITHUB_ENV}
yacd_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' ${yacd_version})
echo "yacd_time=$yacd_time" >> ${GITHUB_ENV}
- name: Checkout `Yacd-meta`
uses: actions/checkout@v4
with:
repository: MetaCubeX/Yacd-meta
fetch-depth: 0
- name: Get `Yacd-meta` version and time
run: |
yacd_meta_version=$(git describe --tags --abbrev=0 HEAD)
echo "yacd_meta_version=$yacd_meta_version" >> ${GITHUB_ENV}
yacd_meta_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' ${yacd_meta_version})
echo "yacd_meta_time=$yacd_meta_time" >> ${GITHUB_ENV}
- name: Checkout `metacubexd`
uses: actions/checkout@v4
with:
repository: MetaCubeX/metacubexd
fetch-depth: 0
- name: Get `metacubexd` version and time
run: |
metacubexd_version=$(git describe --tags --abbrev=0 HEAD)
echo "metacubexd_version=$metacubexd_version" >> ${GITHUB_ENV}
metacubexd_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' ${metacubexd_version})
echo "metacubexd_time=$metacubexd_time" >> ${GITHUB_ENV}
- name: Checkout `zashboard`
uses: actions/checkout@v4
with:
repository: Zephyruso/zashboard
fetch-depth: 0
- name: Get `zashboard` version and time
run: |
zashboard_version=$(git describe --tags --abbrev=0 HEAD)
echo "zashboard_version=$zashboard_version" >> ${GITHUB_ENV}
zashboard_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' ${zashboard_version})
echo "zashboard_time=$zashboard_time" >> ${GITHUB_ENV}
- name: Download and compress `yacd` dashboard
run: |
mkdir -p ./Dashboard/ ./tmp/yacd/
curl -o ./tmp/yacd/gh-pages.zip -L https://github.com/haishanh/yacd/archive/refs/heads/gh-pages.zip
unzip -o ./tmp/yacd/gh-pages.zip -d ./tmp/yacd/
tar -czf ./Dashboard/yacd.tar.gz -C ./tmp/yacd/yacd-gh-pages/ .
- name: Download and compress `Yacd-meta` dashboard
run: |
mkdir -p ./tmp/Yacd-meta/
curl -o ./tmp/Yacd-meta/gh-pages.zip -L https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip
unzip -o ./tmp/Yacd-meta/gh-pages.zip -d ./tmp/Yacd-meta/
tar -czf ./Dashboard/Yacd-meta.tar.gz -C ./tmp/Yacd-meta/Yacd-meta-gh-pages/ .
- name: Download and compress `metacubexd` dashboard
run: |
mkdir -p ./tmp/metacubexd/
curl -o ./tmp/metacubexd/gh-pages.zip -L https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip
unzip -o ./tmp/metacubexd/gh-pages.zip -d ./tmp/metacubexd/
tar -czf ./Dashboard/metacubexd.tar.gz -C ./tmp/metacubexd/metacubexd-gh-pages/ .
- name: Download and compress `zashboard` dashboard
run: |
mkdir -p ./tmp/zashboard/
curl -o ./tmp/zashboard/gh-pages.zip -L https://github.com/Zephyruso/zashboard/releases/latest/download/dist-cdn-fonts.zip
unzip -o ./tmp/zashboard/gh-pages.zip -d ./tmp/zashboard/
tar -czf ./Dashboard/zashboard.tar.gz -C ./tmp/zashboard/dist/ .
rm -rf ./tmp*
- name: Release and upload `Dashboard` assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: Dashboard
tag: Dashboard
overwrite: true
body: |
更新 [yacd 面板](https://github.com/haishanh/yacd)至 ${{ env.yacd_version }},发布于 ${{ env.yacd_time }}
更新 [Yacd-meta 面板](https://github.com/MetaCubeX/Yacd-meta)至 ${{ env.yacd_meta_version }},发布于 ${{ env.yacd_meta_time }}
更新 [metacubexd 面板](https://github.com/MetaCubeX/metacubexd)至 ${{ env.metacubexd_version }},发布于 ${{ env.metacubexd_time }}
更新 [zashboard 面板](https://github.com/Zephyruso/zashboard)至 ${{ env.zashboard_version }},发布于 ${{ env.zashboard_time }}
file_glob: true
file: ./Dashboard/*
- name: Purge jsDelivr CDN
run: |
cd ./Dashboard/ || exit 1
for file in $(ls); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@Dashboard/${file}"
done