-
Notifications
You must be signed in to change notification settings - Fork 36
88 lines (74 loc) · 2.98 KB
/
tokens.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Generate CSS variables
on:
workflow_dispatch:
jobs:
token:
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/token-cli
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
- name: Prepare deps
working-directory: ./
run: |
yarn install --immutable --inline-builds
yarn workspaces foreach -vptR --from @charcoal-ui/token-cli run build
yarn workspaces foreach -vptR --from @charcoal-ui/pullrequest-cli run build
- name: Fetch primitive variables
env:
FIGMA_TOKEN: ${{ secrets.FIGMA_PAT_FOR_VARIABLES}}
FIGMA_FILE_ID: ${{ secrets.FIGMA_NODE_ID_PRIMITIVES }}
run: yarn token-cli fetch -o out/raw_primitives.json
- name: Fetch Applied variables
env:
FIGMA_TOKEN: ${{ secrets.FIGMA_PAT_FOR_VARIABLES }}
FIGMA_FILE_ID: ${{ secrets.FIGMA_NODE_ID_APPLIEDS }}
run: yarn token-cli fetch -o out/raw_applieds.json
- name: Transform primitive token
run: yarn token-cli transform --source ./out/raw_primitives.json --output ./tokens/base.json
- name: Transform applied token
run: |
yarn token-cli transform --source ./out/raw_applieds.json --output ./tokens/pixiv-light.json --variable-collection-names Color Space "Border radius" --mode-name "pixiv/light"
yarn token-cli transform --source ./out/raw_applieds.json --output ./tokens/pixiv-dark.json --variable-collection-names Color Space "Border radius" --mode-name "pixiv/dark"
- name: Generate CSS variables
run: |
yarn style-dictionary build -c pixiv-light.config.js
yarn style-dictionary build -c pixiv-dark.config.js
- name: Copy to theme package
run: |
rm -rf ../theme/src/json
rm -rf ../theme/src/css
cp -r ./tokens ../theme/src/json
cp -r ./build/css ../theme/src/css
- name: Generate github token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.CHARCOAL_BOT_APP_ID }}
private_key: ${{ secrets.CHARCOAL_BOT_PRIVATE_KEY }}
- name: Create Pull Request
working-directory: ./
env:
GITHUB_ACCESS_TOKEN: ${{ steps.generate_token.outputs.token }}
GITHUB_REPO_OWNER: pixiv
GITHUB_REPO_NAME: charcoal
GITHUB_DEFAULT_BRANCH: ${{ github.ref_name }}
TARGET_DIR: packages/theme
run: yarn pullrequest-cli github:pr -c theme -t 'Update theme'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: generated css
path: packages/token-cli/build/css
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: generated tokens json
path: packages/token-cli/tokens