Build Tokens Package #70
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds the tokens package to update the figma folder | |
name: 'Build Tokens Package' | |
on: | |
workflow_dispatch: | |
push: | |
paths: ['packages/tokens/**'] | |
branches: | |
- main | |
env: | |
FIGMA_FILES_CHANGED: | |
jobs: | |
tokens-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.VA_MOBILE_ROBOT_GITHUB_PAT }} | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
registry-url: https://registry.npmjs.org/ | |
node-version-file: .nvmrc | |
cache: yarn | |
cache-dependency-path: yarn.lock | |
- run: yarn install | |
- name: Clean `figma` folder | |
working-directory: packages/tokens | |
run: rm -rf figma | |
- run: yarn tokens:build | |
- name: Prepare commit | |
working-directory: packages/tokens | |
run: | | |
git config --global user.name 'VA Automation Bot' | |
git config --global user.email '[email protected]' | |
rm -rf dist | |
git pull | |
git add -f figma/ | |
- name: Check for `figma` diff | |
working-directory: packages/tokens | |
run: echo "FIGMA_FILES_CHANGED=$(git diff HEAD --name-only figma | wc -l)" >> $GITHUB_ENV | |
- name: No changes to `figma` tokens | |
if: ${{ env.FIGMA_FILES_CHANGED == 0 }} | |
run: echo No changes to figma tokens | |
- name: Commit latest `figma` tokens | |
if: ${{ env.FIGMA_FILES_CHANGED >= 1 }} | |
working-directory: packages/tokens | |
run: | | |
git commit -m 'Build latest figma tokens' | |
git push |