Home

Awesome

FIGCD - A CLI Tool for Continuous Delivery of Figma Plugins

Version License

This CLI tool is inspired by the insightful talk of Jean-François Bisson at config 2023 and the incredible work of Fastlane (the counterpart for iOS and Android apps).

During the development of Parrot – a Figma Plugin that simplifies translation within Figma – I faced the challenge of setting up a reliable Continuous Delivery process and the manual process of publishing within the Figma app.

This figcd CLI aims to ease those frustrations, allowing you to effortlessly integrate the latest source state into Figma, streamline the manual publishing process, and seamlessly incorporate it into a state-of-the-art CI/CD setup. With figcd, you can focus on your creative work while ensuring your Figma plugins reach users smoothly and efficiently.

Table of Contents

Installation

To get started with the figcd CLI, you need to have Node.js installed. Then, install the package globally using npm:

npm install -g figcd

Usage

Running with npx

If you don't have the CLI installed globally or want to use the latest version without installing it, you can use npx to run the CLI directly:

npx figcd <command> [options]

For example:

npx figcd auth

Running within a GitHub Action

To use figcd within a GitHub Action, follow these steps to set up the necessary authentication token:

  1. Obtain a fresh authentication token by running the following command on your local machine:
npx figcd auth

This command will prompt you to log in using 2-factor authentication and generate a new Figma API token.

  1. Add the created token as a GitHub Action secret. Go to your GitHub repository, click on "Settings" > "Secrets" and then click "New repository secret". Name the secret FIGMA_WEB_AUTHN_TOKEN and paste the token value into the "Value" field. Click "Add secret" to save it.

  2. In your GitHub Action workflow file (e.g., .github/workflows/publish.yml), make the token available as an environment variable using the env keyword:

jobs:
    my_job:
    runs-on: ubuntu-latest

    env:
        FIGMA_WEB_AUTHN_TOKEN: ${{ secrets.FIGMA_WEB_AUTHN_TOKEN }}

    steps:
        # Add your other steps here

With these steps completed, figcd will be able to use the authentication token during the GitHub Action run.

Sample Workflow File

For a complete example of how to use figcd in a GitHub Action, check out our sample workflow file located in the examples directory.

This workflow demonstrates the process of setting up figcd, authenticating with Figma, and automating the plugin publishing steps. You can use this as a starting point for integrating figcd into your own GitHub Actions.

Happy automating!

figcd - cli

If you have the figcd package installed in your project's dependencies, you can run the CLI commands directly:

Authentication

Authenticate in Figma to get the AuthN Token needed to publish using Figma's web API.

figcd fig-auth [options]

Options:

Get Current Version

Get the current Version of the plugin.

figcd current-version [options]

Options:

Prepare Plugin Version

Sets the package.json files minor part of the version to the next version of the Figma plugin. Expects a valid AuthN Token from Figma set to the FIGMA_WEB_AUTHN_TOKEN environment variable.

figcd prepare [options]

Options:

Create API Key

Create a Figma API key.

figcd create-api-key [options]

Options:

Release New Version

Release a new version of your Figma plugin (expects the build to be done in an earlier step).

figcd release [options]

Options:

Options

License

This project is licensed under the MIT License. See the LICENSE file for details.

Disclaimer: This project does in no way affiliated with Figma Inc. This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs. figcd runs on your own computer or server, so your credentials or other sensitive information will never leave your own computer. You are responsible for how you use figcd.


This README provides an overview of the figcd CLI's capabilities and how to use its various commands and options. Feel free to customize it further based on your package's specific features and requirements. Happy coding!