Icon Modifier #137
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: Icon Modifier | |
permissions: write-all | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
TAG: ${{ env.LATEST_UPSTREAM_TAG }} | |
NEED_UPDATE: ${{ steps.compare_tags.outputs.NEED_UPDATE }} | |
steps: | |
- name: Get Latest Tag | |
id: latest_tag | |
run: | | |
echo "LATEST_TAG=$(curl -s https://api.github.com/repos/rahaaatul/kustom-tabler-icons/releases/latest | jq -r .tag_name)" >> $GITHUB_ENV | |
- name: Get Latest Upstream Tag | |
id: latest_upstream_tag | |
run: | | |
echo "LATEST_UPSTREAM_TAG=$(curl -s https://api.github.com/repos/tabler/tabler-icons/releases/latest | jq -r .tag_name)" >> $GITHUB_ENV | |
- name: Compare Latest Tags | |
id: compare_tags | |
run: | | |
if [ "$LATEST_UPSTREAM_TAG" != "$LATEST_TAG" ]; then | |
echo "NEED_UPDATE=1" >> $GITHUB_OUTPUT | |
else | |
echo "NEED_UPDATE=0" >> $GITHUB_OUTPUT | |
fi | |
sync: | |
needs: check | |
if: ${{ needs.check.outputs.NEED_UPDATE == '1' }} | |
runs-on: ubuntu-latest | |
env: | |
TAG: ${{ needs.check.outputs.TAG }} | |
outputs: | |
TAG: ${{ needs.check.outputs.TAG }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Add Upstream | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
if git remote | grep -q "upstream"; then | |
echo "Remote 'upstream' already exists." | |
else | |
git remote add upstream https://github.com/tabler/tabler-icons.git | |
fi | |
- name: Fetch Upstream | |
run: | | |
git config --global http.postBuffer 524288000 | |
while true; do | |
if git fetch upstream main --depth=1 --no-tags; then | |
break | |
else | |
echo "Fetch failed, retrying in 10 seconds..." | |
sleep 10 | |
fi | |
done | |
- name: Checkout Icons | |
run: git checkout upstream/main -- icons/filled icons/outline | |
- name: Stage Files | |
run: git add icons/filled icons/outline .github/workflows/manual.yml | |
- name: Commit Changes | |
run: git commit -m "${{ env.TAG }}" | |
- name: Push Changes | |
run: git push origin main | |
release: | |
needs: sync | |
runs-on: ubuntu-latest | |
env: | |
TAG: ${{ needs.sync.outputs.TAG }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install NodeJS Packages | |
run: npm install -g oslllo-svg-fixer svgtofont | |
- name: Create Temporary Folder | |
run: mkdir -pv temp/icons temp/fixed | |
- name: Fix Outline Icons | |
run: oslllo-svg-fixer --source icons/outline --destination temp/fixed | |
- name: Rename & move fixed icons to temp folder | |
run: | | |
for SVG in temp/fixed/*.svg; do | |
mv -f $SVG "temp/icons/$(basename "${SVG%.svg}")-outline.svg" | |
done | |
- name: Rename & move filled icons to temp folder | |
run: | | |
for SVG in icons/filled/*.svg; do | |
mv -f $SVG "temp/icons/$(basename "${SVG%.svg}")-filled.svg" | |
done | |
- name: Pack icons into a font file | |
run: svgtofont --sources temp/icons --output temp --fontName tabler-icons | |
- name: Fix font icon ID's | |
run: node .github/scripts/fix-json.js | |
- name: Release Font Files | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
temp/tabler-icons.ttf | |
temp/tabler-icons.json | |
name: "${{ env.TAG }}" | |
tag_name: "${{ env.TAG }}" |