RedMadRobot / figma-export

Command line utility to export colors, typography, icons and images from Figma to Xcode / Android Studio project
MIT License
718 stars 114 forks source link

Running Figma-export on Github Actions #219

Closed ateek closed 6 months ago

ateek commented 9 months ago

I did download the artifact and included it in my CI/CD setup using GitHub actions I can see that all my icons have been downloaded correctly but the I got stuck on this step.

Converting SVGs to XMLs...

it took more than half an hour

I'm using macos-latest github hosted runner

https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

the setup is like that


name: Figma Export

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: macos-latest
    env:
      FIGMA_PERSONAL_TOKEN: ${{ secrets.FIGMA_PERSONAL_TOKEN }}

    steps:
      - uses: actions/checkout@v2

      - name: Download Figma Export
        run: bash .github/ci/download_figma_export_artifact.sh

      - name: Run Figma Export
        run: ./Release/figma-export icons
``
subdan commented 9 months ago

Did you try to run figma-export locally?

ateek commented 9 months ago

Yeah it works perfectly fine locally.

subdan commented 9 months ago

Did you install vd-tool and Java Runtime on your CI?

ateek commented 9 months ago

Java was already installed, I added the vd-tool using this command

      - uses: actions/setup-node@v3
        with:
          node-version: 18

      - run: npm install -g vd-tool

https://www.npmjs.com/package/vd-tool

I still have the same problem 🤔

subdan commented 9 months ago

FigmaExport tries to find vd tool by these paths:

Could you please run which vd-tool on the CI and show me output?

ateek commented 9 months ago

@subdan it returns this path

/Users/runner/hostedtoolcache/node/18.17.1/x64/bin/vd-tool
subdan commented 9 months ago

So FigmaExport can't find vd-tool. Do you have vd-tool near the FigmaExport?

image
ateek commented 9 months ago

@subdan Yeah I downloaded the release from the https://github.com/RedMadRobot/figma-export/releases/tag/0.37.2

ateek commented 9 months ago

@subdan it is in the same directory as the figma-export artifact

subdan commented 9 months ago

@subdan it is in the same directory as the figma-export artifact

Like this?

image
subdan commented 9 months ago

Try to go to Release directory before running FigmaExport.

- name: Run Figma Export
  working-directory: ./Release
  run: figma-export icons
ateek commented 9 months ago

I tried that and I'm getting this error

Run figma-export icons
/Users/runner/work/_temp/7fdfc922-d20d-48c4-acf8-aeff5392a255.sh: line 1: figma-export: command not found
Error: Process completed with exit code 127.
subdan commented 9 months ago

Do you have still getting the error?

subdan commented 9 months ago

I've tried to run FigmaExport using GitHub Actions and it works as expected: https://github.com/RedMadRobot/figma-export/blob/temp/.github/workflows/temp.yml https://github.com/RedMadRobot/figma-export/actions/runs/6397191232/job/17364605877

ateek commented 9 months ago

@subdan Thanks for your response but you are using the iOS example, not the android one, in the code you shared https://github.com/RedMadRobot/figma-export/blob/temp/Examples/Example/figma-export.yaml

subdan commented 9 months ago

Try to copy contents of Release directory to /usr/local/bin before running FigmaExport:

 cp -a ./figma-export-release/Release/. /usr/local/bin/
ateek commented 9 months ago

it works but couldn't find the location of the downloaded files

Error: The file “ic_16_key_emergency.xml” doesn’t exist.
subdan commented 9 months ago

It seems that copying contents of Release directory to the /usr/local/bin doesn't work as expected. GitHub Actions can't find vd-tool command:

The operation couldn’t be completed. Permission denied
The file “vd-tool” doesn’t exist.

FigmaExport is designed to run locally, not on CI. Why do you want to run FigmaExport on CI?

ateek commented 9 months ago

@subdan thanks for the investigation and the insights 🙏🏽 this is a great tool that we often use it, and it made a lot of sense to automate this