Delete icons/MI.PNG #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Icons JSON | |
on: | |
push: | |
paths: | |
- 'icons/**.png' | |
- 'icons/**.PNG' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install jq | |
run: sudo apt-get install -y jq | |
- name: Generate icons.json | |
run: | | |
ICONS_JSON='{"name": "icons", "description": "By cc63", "icons": []}' | |
for icon in icons/*.png icons/*.PNG; do | |
ICON_NAME=$(basename "$icon" .png) | |
ICON_NAME=$(basename "$ICON_NAME" .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 |