Skip to content

Release/v3.1.0 3d loaders and smart components #16

Release/v3.1.0 3d loaders and smart components

Release/v3.1.0 3d loaders and smart components #16

Workflow file for this run

name: Pull Request Checks
on:
pull_request:
branches:
- main
permissions:
contents: read
checks: write
pull-requests: write
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install root dependencies
run: npm ci
- name: Run TypeScript type check
run: npm run type-check
- name: Build library
run: npm run build
- name: Build Storybook
run: npm run build-storybook
- name: Install demo dependencies
run: cd demo && npm ci
- name: Build demo app
run: cd demo && npm run build
- name: Check package size
run: |
echo "📦 Package Size Report"
echo "====================="
du -sh dist
echo ""
echo "CSS Size:"
ls -lh dist/premium-react-loaders.css | awk '{print $5}'
echo ""
echo "Total Files:"
find dist -type f | wc -l
lint-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check for Tailwind references
run: |
echo "🔍 Checking for Tailwind references in library code..."
TAILWIND_COUNT=$(grep -r "tailwindcss\|@tailwind" src --include="*.ts" --include="*.tsx" --include="*.css" 2>/dev/null | wc -l || echo 0)
if [ "$TAILWIND_COUNT" -ne 0 ]; then
echo "❌ Found $TAILWIND_COUNT Tailwind references in library code"
grep -r "tailwindcss\|@tailwind" src --include="*.ts" --include="*.tsx" --include="*.css"
exit 1
else
echo "✅ No Tailwind references found in library code"
fi
- name: Check for clsx imports
run: |
echo "🔍 Checking for clsx imports..."
CLSX_COUNT=$(grep -r "from 'clsx'" src --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l || echo 0)
if [ "$CLSX_COUNT" -ne 0 ]; then
echo "❌ Found $CLSX_COUNT clsx imports"
grep -r "from 'clsx'" src --include="*.ts" --include="*.tsx"
exit 1
else
echo "✅ No clsx imports found"
fi
deploy-preview:
runs-on: ubuntu-latest
needs: [build-and-test, lint-check]
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install root dependencies
run: npm ci
- name: Build Storybook
run: npm run build-storybook
- name: Install demo dependencies
run: cd demo && npm ci
- name: Build demo app
run: cd demo && npm run build
- name: Deploy Storybook Preview to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
id: deploy-storybook
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PREMIUM_REACT_LOADERS }}'
projectId: premium-react-loaders
expires: 7d
- name: Deploy Demo Preview to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
id: deploy-demo
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PREMIUM_REACT_LOADERS_DEMO }}'
projectId: premium-react-loaders-demo
entryPoint: demo
expires: 7d
- name: Comment PR with Preview URLs
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const storybookUrl = '${{ steps.deploy-storybook.outputs.details_url }}';
const demoUrl = '${{ steps.deploy-demo.outputs.details_url }}';
const comment = `## 🚀 Preview Deployments
Your PR has been deployed to Firebase preview channels!
### 📚 Storybook Documentation
🔗 [View Storybook Preview](${storybookUrl})
### 🎨 Demo Application
🔗 [View Demo Preview](${demoUrl})
---
Preview deployments will be automatically deleted after 7 days.
<sub>Built with commit ${context.sha.substring(0, 7)}</sub>`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});