-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.61 KB
/
tokens-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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 'va-mobileapp@adhocteam.us'
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