Skip to content

Commit 1034659

Browse files
committed
Add CI/CD integration for Figma Code Connect validation and publishing
1 parent 1e3516d commit 1034659

File tree

10 files changed

+253
-1683
lines changed

10 files changed

+253
-1683
lines changed

.github/workflows/_build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ jobs:
105105
- name: Unit Tests
106106
run: ./gradlew test${{ env.flavour }}${{ env.config }}UnitTest -PdisablePreDex
107107

108+
- name: Validate Code Connect files
109+
run: |
110+
if find backpack-compose/src/main/kotlin -name "*.figma.kt" -type f | grep -q .; then
111+
echo "🔍 Found Code Connect files, validating..."
112+
npx @figma/code-connect parse --verbose
113+
npx @figma/code-connect publish --dry-run
114+
else
115+
echo "No Code Connect files found, skipping validation"
116+
fi
117+
env:
118+
FIGMA_ACCESS_TOKEN: ${{ secrets.FIGMA_ACCESS_TOKEN }}
119+
108120
Android:
109121
name: Android tests
110122
runs-on: ubuntu-24.04-16cores-public

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ jobs:
7979
- name: Update Supernova docs
8080
run: npx @supernovaio/cli publish-documentation --apiKey=${{ secrets.SUPERNOVA_API_KEY }} --designSystemId=${{ secrets.SUPERNOVA_DESIGN_SYSTEM_ID }}
8181

82+
- name: Publish Code Connect to Figma
83+
run: npx @figma/code-connect publish --exit-on-unreadable-files
84+
env:
85+
FIGMA_ACCESS_TOKEN: ${{ secrets.FIGMA_ACCESS_TOKEN }}
86+
8287
- name: Publish release to Runway
8388
run: |
8489
set -e
@@ -87,3 +92,4 @@ jobs:
8792
RUNWAY_API_KEY: ${{ secrets.RUNWAY_API_KEY }}
8893
RUNWAY_APP_ID: ${{ secrets.RUNWAY_APP_ID }}
8994
RUNWAY_BUCKET_ID: ${{ secrets.RUNWAY_BUCKET_ID }}
95+

figma-code-connect/README.md

Lines changed: 19 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,27 @@
1-
# Figma Code Connect Integration for Backpack Android
1+
# Figma Code Connect
22

3-
## Overview
3+
Generates code snippets from Figma designs for Backpack Android components.
44

5-
Figma Code Connect bridges the gap between design and development by automatically generating accurate code snippets from Figma designs. This guide walks you through integrating and using Figma Code Connect with Backpack Android components.
5+
## Quick Start
66

7-
## 📚 Documentation Structure
7+
1. Get [Figma access token](https://www.figma.com/settings)
8+
2. `export FIGMA_ACCESS_TOKEN="your_token"`
9+
3. Create `Component.figma.kt` with annotations
10+
4. Test: `npx @figma/code-connect parse --verbose`
11+
5. Publish: `npx @figma/code-connect publish`
812

9-
This guide is split into focused documents for easier navigation:
13+
## Documentation
1014

11-
1. **[Getting Started](./getting-started.md)** - Initial setup and installation
12-
2. **[Component Integration](./component-integration.md)** - How to add Code Connect to components
13-
3. **[Annotations Guide](./annotations-guide.md)** - Complete reference for all annotations
14-
4. **[Testing & Publishing](./testing-publishing.md)** - Verification and deployment workflow
15-
5. **[Examples](./examples.md)** - Real-world implementation examples
16-
6. **[Quick Reference](./quick-reference.md)** - Essential commands and patterns
15+
- **[Getting Started](./getting-started.md)** - Setup and installation
16+
- **[Annotations Guide](./annotations-guide.md)** - Annotation reference
17+
- **[Component Integration](./component-integration.md)** - Adding to components
18+
- **[Examples](./examples.md)** - Real implementations
19+
- **[Testing & Publishing](./testing-publishing.md)** - Verification workflow
20+
- **[CI Integration](./ci-integration.md)** - CI/CD setup
21+
- **[Quick Reference](./quick-reference.md)** - Commands and patterns
1722

18-
## 🚀 Quick Start
23+
## Current Components
1924

20-
If you're already familiar with the setup, here's the essential workflow:
21-
22-
1. **Add annotations** to your component
23-
2. **Test locally**: `figma connect parse --verbose`
24-
3. **Test publishing**: `figma connect publish --dry-run`
25-
4. **Publish**: `figma connect publish`
26-
27-
## 🎯 What You'll Learn
28-
29-
- ✅ How to set up Figma Code Connect in Backpack Android
30-
- ✅ When and how to use different annotations (`@FigmaConnect`, `@FigmaVariant`, `@FigmaProperty`)
31-
- ✅ Best practices for component integration
32-
- ✅ Testing and publishing workflow
33-
- ✅ Real examples from `BpkButton` and `BpkText`
34-
35-
## 🔧 Prerequisites
36-
37-
- Android Studio with Kotlin support
38-
- Node.js (for Figma CLI)
39-
- Access to Backpack Figma workspace
40-
- Figma personal access token
41-
42-
## 📋 Current Integration Status
43-
44-
### ✅ Integrated Components
45-
- **BpkButton** - 4 icon variants (None, Left, Right, Icon only)
46-
- **BpkText** - 18 typography variants (Hero1-5, Heading1-5, etc.)
25+
- **BpkButton** - 4 icon variants
26+
- **BpkText** - 18 typography variants
4727
- **BpkCard** - Basic example
48-
49-
### 🔄 Integration Pattern
50-
Each component variant uses individual `@FigmaVariant` classes for clean, parser-friendly code generation.
51-
52-
## 🆘 Need Help?
53-
54-
- **Quick questions**: Check the [Annotations Guide](annotations-guide.md)
55-
- **Setup issues**: See [Getting Started](getting-started.md)
56-
- **Integration patterns**: Review [Examples](examples.md)
57-
- **Testing problems**: Visit [Testing & Publishing](testing-publishing.md)
58-
59-
---
60-
61-
**Next Step**: Start with [Getting Started](getting-started.md) to set up your development environment.

0 commit comments

Comments
 (0)