-
Notifications
You must be signed in to change notification settings - Fork 4
35 lines (29 loc) · 1.03 KB
/
sync_icons.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
name: Generate Icons JSON
on:
push:
paths:
- 'icons/**.png'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4 # 更新到最新版本
- name: Install jq
run: sudo apt-get install -y jq
- name: Generate icons.json
run: |
ICONS_JSON='{"name": "icons", "description": "适用于Sub-Store的机场图标库", "icons": []}'
for icon in icons/*.png; do
ICON_NAME=$(basename "$icon" .png)
ICON_URL="https://raw.githubusercontent.com/cc63/ICON/main/$icon"
ICONS_JSON=$(echo "$ICONS_JSON" | jq --arg name "$ICON_NAME" --arg url "$ICON_URL" '.icons += [{"name": $name, "url": $url}]')
done
echo "$ICONS_JSON" > icons.json
- name: Commit and push changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add icons.json
git commit -m "Update icons.json" -a || echo "No changes to commit"
git push