Skip to content

docs: add icon-grid svg #8

docs: add icon-grid svg

docs: add icon-grid svg #8

name: handle icon additions
on:
push:
branches:
- main
paths:
- 'packages/core/src/raw-svgs/**'
pull_request:
paths:
- 'packages/core/src/raw-svgs/**'
jobs:
update-and-rebuild:
runs-on: ubuntu-latest
steps:
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: bun install
- name: Update Metadata
id: update_metadata
run: |
newIcons=$(git diff --name-only HEAD~1 HEAD | grep 'packages/core/src/raw-svgs/' | xargs basename -a | sed 's/.svg//' | tr '\n' ', ' | sed 's/, $//')
echo "newIcons=$newIcons" >> $GITHUB_ENV
bun run ./packages/utils/src/scripts/update-metadata.ts
- name: Rebuild Core Package
run: bun run build:core
- name: Rebuild React Package
run: bun run build:react
- name: Create changeset
run: |
if [ -n "$newIcons" ]; then
echo "
---
'@token-icons/core': minor
'@token-icons/react': minor
---
Added icons: $newIcons" > .changeset/$(date +%s).md
fi
- name: Bump versions
run: bun changeset version
- name: Commit changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add packages/core packages/react .changeset/
if [ -n "$newIcons" ]; then
git commit -m "core: add ${{ env.newIcons }}" || echo "No changes to commit"
else
echo "No new icons to commit"
fi
git push
publish:
needs: update-and-rebuild
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: bun install
- name: Publish to npm
run: bun changeset publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}