name: Update Lucide Icons and Release
on:
# Schedule to check for new releases daily at 2 AM UTC
schedule:
- cron: "0 2 * * *"
# Allow manual triggering
workflow_dispatch:
env:
NODE_VERSION: "22"
LUCIDE_VERSION_FILE: "data/version.txt"
PR_BRANCH_PREFIX: "update-lucide"
jobs:
# Step 1: Check if update is needed
check-release:
name: Check for new Lucide release
runs-on: ubuntu-latest
outputs:
needs_update: ${{ steps.version_check.outputs.needs_update }}
latest_version: ${{ steps.version_check.outputs.latest_version }}
current_version: ${{ steps.version_check.outputs.current_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check for new Lucide release
id: version_check
run: |
echo "π Checking for new Lucide release..."
# Get latest release from Lucide repository
LATEST_RELEASE=$(curl -s https://api.github.com/repos/lucide-icons/lucide/releases/latest | jq -r '.tag_name')
echo "π Latest Lucide release: $LATEST_RELEASE"
# Get current version from our data (if exists)
if [ -f "${{ env.LUCIDE_VERSION_FILE }}" ]; then
CURRENT_VERSION=$(cat ${{ env.LUCIDE_VERSION_FILE }})
echo "π Current version: $CURRENT_VERSION"
else
CURRENT_VERSION="none"
echo "π No current version found"
fi
# Set outputs
echo "latest_version=$LATEST_RELEASE" >> $GITHUB_OUTPUT
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
if [ "$LATEST_RELEASE" != "$CURRENT_VERSION" ]; then
echo "β
Update needed!"
echo "needs_update=true" >> $GITHUB_OUTPUT
else
echo "βοΈ No update needed"
echo "needs_update=false" >> $GITHUB_OUTPUT
fi
# Step 2: Update icons and create PR
update-icons:
name: Update icons and create PR
runs-on: ubuntu-latest
needs: check-release
if: needs.check-release.outputs.needs_update == 'true'
outputs:
pr_number: ${{ steps.create_pr.outputs.pull-request-number }}
pr_url: ${{ steps.create_pr.outputs.pull-request-url }}
has_changes: ${{ steps.check_changes.outputs.has_changes }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: |
echo "π¦ Installing dependencies..."
bun install
- name: Setup Python and Camoufox
run: |
echo "π§ Setting up Python and Camoufox..."
pip install -U camoufox[geoip]
python -m camoufox fetch
- name: Update icon data
run: |
echo "π Updating icon data for Lucide ${{ needs.check-release.outputs.latest_version }}..."
bun run pre-build
# Update version file
mkdir -p data
echo "${{ needs.check-release.outputs.latest_version }}" > ${{ env.LUCIDE_VERSION_FILE }}
- name: Build and lint
run: |
echo "ποΈ Building project..."
bun run build
echo "π§Ή Running linter..."
bun run lint:fix
- name: Check for changes
id: check_changes
run: |
git add .
if git diff --staged --quiet; then
echo "π No changes detected"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "π Changes detected"
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.check_changes.outputs.has_changes == 'true'
id: create_pr
uses: peter-evans/create-pull-request@v7
with:
commit-message: "feat: update Lucide icons to ${{ needs.check-release.outputs.latest_version }}"
title: "π Update Lucide icons to ${{ needs.check-release.outputs.latest_version }}"
body: |
## π Automated Lucide Icons Update
This pull request updates the Lucide icons data to version `${{ needs.check-release.outputs.latest_version }}`.
### π Summary
- **Previous Lucide Icon version:** `${{ needs.check-release.outputs.current_version }}`
- **New Lucide Icon version:** `${{ needs.check-release.outputs.latest_version }}`
### π Changes
- Updated icon metadata and categories from Lucide website
- Updated version tracking in `${{ env.LUCIDE_VERSION_FILE }}`
### π€ Automation
This PR was automatically created by the **Update Lucide Icons** GitHub Actions workflow.
---
**Workflow run:** [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
branch: ${{ env.PR_BRANCH_PREFIX }}-${{ needs.check-release.outputs.latest_version }}
delete-branch: true
# Step 3: Auto Merge PR
merge-pr:
name: Auto-merge Lucide update PR
runs-on: ubuntu-latest
needs: update-icons
if: needs.update-icons.outputs.has_changes == 'true'
outputs:
merged: ${{ steps.merge.outputs.merged }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- id: merge
run: |
gh pr merge --merge --auto "${{ needs.update-icons.outputs.pr_number }}"
echo "merged=true" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Create release and publish
runs-on: ubuntu-latest
needs: [check-release, merge-pr]
if: needs.merge-pr.outputs.merged == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- id: version
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
NEW_VERSION=$(node -p "
const semver = '$CURRENT_VERSION'.split('.');
semver[2] = String(parseInt(semver[2]) + 1);
semver.join('.');
")
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
- run: |
node -e "
const pkg = require('./package.json');
pkg.version = '${{ steps.version.outputs.new_version }}';
require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\n');
"
- run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add package.json
git commit -m "chore: bump version to ${{ steps.version.outputs.new_version }}"
git pull --rebase origin main
git push
- name: Install dependencies for publish
run: |
echo "π¦ Installing dependencies for release packaging..."
bun install
- name: Build package artifacts
run: |
echo "ποΈ Building package before publish..."
bun run build
- id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.new_version }}
name: π Release v${{ steps.version.outputs.new_version }}
body: |
## π Release v${{ steps.version.outputs.new_version }}
### π Updated Lucide Icons
- **Lucide version:** `${{ needs.check-release.outputs.latest_version }}`
### π¦ Installation
```bash
npm install -g lucide-icons-mcp@${{ steps.version.outputs.new_version }}
npm install lucide-icons-mcp@${{ steps.version.outputs.new_version }}
```
### π Changes
- Updated Lucide icons to ${{ needs.check-release.outputs.latest_version }}
- Refreshed icon metadata and categories
- Updated build artifacts and dependencies
### π€ Automation
This release was automatically created.
---
π·οΈ **Tags:** lucide-icons, mcp-server, automated-release
draft: false
prerelease: false
generate_release_notes: true
- if: env.NODE_AUTH_TOKEN != ''
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}