Skip to content

Add files via upload #13

Add files via upload

Add files via upload #13

Workflow file for this run

name: Generate Color JSON
on:
push:
paths:
- 'Color/**.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 Color.json
run: |
ICONS_JSON='{"name": "Color", "description": "适用于Sub-Store的机场图标库", "icons": []}'
echo "Initial JSON: $ICONS_JSON"
for icon in Color/*.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}]')
echo "Added $ICON_NAME to JSON"
done
echo "$ICONS_JSON" > Color.json
echo "Generated Color.json: $(cat Color.json)"
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add Color.json
git commit -m "Update Color.json" -a || echo "No changes to commit"
git push