build icon via webhook #49
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
name: build icon via webhook | |
on: | |
workflow_dispatch: | |
inputs: | |
modified_components: | |
description: 'JSON array for modified components' | |
required: true | |
default: '["ALL"]' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
build_icons: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: restore lerna | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-v2 | |
- run: yarn install --frozen-lockfile | |
- name: Update Icons | |
env: | |
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }} | |
FIGMA_ACCESS_TOKEN: ${{ secrets.FIGMA_TOKEN_CODE_CONNECT }} # This is for Figma Code Connect in spindle-ui | |
FILE_KEY: ${{ secrets.FIGMA_ICON_FILE_KEY }} | |
NODE_ID: ${{ secrets.FIGMA_ICON_NODE_ID }} | |
ICON_NAMES: ${{ github.event.inputs.modified_components }} | |
run: | | |
node -p "JSON.stringify({ fileKey: '$FILE_KEY', nodeId: '$NODE_ID', dest: 'dist', iconNames: '$ICON_NAMES' })" > packages/spindle-icons/figma.json | |
yarn lerna run --scope @openameba/spindle-icons build | |
yarn lerna run --scope @openameba/spindle-ui icon | |
yarn fix | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
commit-message: 'feat(spindle-icons): update icons' | |
branch: feat/build-icon-via-webhook | |
delete-branch: true | |
title: 'feat(spindle-icons): update icons' | |
body: ${{ github.event.inputs.modified_components }} | |
labels: | | |
spindle-icons | |
spindle-ui |