Skip to content

Commit 8a4a051

Browse files
authored
feat: Add BerkeleyMono font with S3 download for release builds (#951)
1 parent 39e07bf commit 8a4a051

5 files changed

Lines changed: 85 additions & 11 deletions

File tree

.github/workflows/twig-release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ concurrency:
1212
jobs:
1313
publish:
1414
runs-on: macos-latest
15+
permissions:
16+
id-token: write
17+
contents: write
1518
env:
1619
NODE_OPTIONS: "--max-old-space-size=8192"
1720
NODE_ENV: production
@@ -68,6 +71,17 @@ jobs:
6871
- name: Install dependencies
6972
run: pnpm install --frozen-lockfile
7073

74+
- name: Configure AWS credentials
75+
uses: aws-actions/configure-aws-credentials@v4
76+
with:
77+
role-to-assume: ${{ secrets.AWS_TWIG_APP_ASSETS_ROLE_ARN }}
78+
aws-region: ${{ secrets.AWS_TWIG_APP_ASSETS_REGION }}
79+
mask-aws-account-id: true
80+
unset-current-credentials: true
81+
82+
- name: Download BerkeleyMono fonts from S3
83+
run: aws s3 cp s3://${{ secrets.AWS_TWIG_APP_ASSETS_BUCKET }}/fonts/BerkeleyMono/ apps/twig/assets/fonts/BerkeleyMono/ --recursive
84+
7185
- name: Build electron-trpc package
7286
run: pnpm --filter @posthog/electron-trpc run build
7387

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ test-results/
5050

5151
# Downloaded binaries
5252
apps/twig/resources/codex-acp/
53+
54+
# Licensed fonts (downloaded from S3 during CI)
55+
apps/twig/assets/fonts/BerkeleyMono/

apps/twig/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ If you don't have Xcode installed, the build will automatically fall back to the
5151

5252
The `generateAssets` hook will automatically attempt to compile the icon during packaging if Xcode is available.
5353

54+
### BerkeleyMono Font (PostHog employees)
55+
56+
Twig uses [Berkeley Mono](https://usgraphics.com/products/berkeley-mono) as its primary font, falling back to JetBrains Mono if the files aren't present. The font is licensed and not committed to the repo — it's downloaded from S3 during CI builds.
57+
58+
To use it locally, go to the Twig app assets S3 bucket in the AWS console, download the `.woff2` files from the `fonts/` folder, and place them in:
59+
60+
```
61+
apps/twig/assets/fonts/BerkeleyMono/
62+
```
63+
64+
The directory is gitignored, so these files won't be committed.
65+
5466
### Environment Variables
5567

5668
You can set these environment variables instead of entering credentials in the app:

apps/twig/src/renderer/styles/globals.css

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@
22
@tailwind components;
33
@tailwind utilities;
44

5+
@font-face {
6+
font-family: "Berkeley Mono";
7+
src: url("/assets/fonts/BerkeleyMono/BerkeleyMono-Regular.woff2")
8+
format("woff2");
9+
font-weight: 400;
10+
font-style: normal;
11+
}
12+
13+
@font-face {
14+
font-family: "Berkeley Mono";
15+
src: url("/assets/fonts/BerkeleyMono/BerkeleyMono-Oblique.woff2")
16+
format("woff2");
17+
font-weight: 400;
18+
font-style: italic;
19+
}
20+
21+
@font-face {
22+
font-family: "Berkeley Mono";
23+
src: url("/assets/fonts/BerkeleyMono/BerkeleyMono-Bold.woff2") format("woff2");
24+
font-weight: 700;
25+
font-style: normal;
26+
}
27+
28+
@font-face {
29+
font-family: "Berkeley Mono";
30+
src: url("/assets/fonts/BerkeleyMono/BerkeleyMono-Bold-Oblique.woff2")
31+
format("woff2");
32+
font-weight: 700;
33+
font-style: italic;
34+
}
35+
536
@font-face {
637
font-family: "JetBrains Mono";
738
src: url("/assets/fonts/JetBrainsMono/JetBrainsMono-Light.woff2")
@@ -131,19 +162,25 @@
131162
.radix-themes {
132163
/* Font families */
133164
--default-font-family:
134-
"JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono", "Courier New", monospace;
165+
"Berkeley Mono", "JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono",
166+
"Courier New", monospace;
135167
--heading-font-family:
136-
"JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono", "Courier New", monospace;
168+
"Berkeley Mono", "JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono",
169+
"Courier New", monospace;
137170
--code-font-family:
138-
"JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono", "Courier New", monospace;
171+
"Berkeley Mono", "JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono",
172+
"Courier New", monospace;
139173
--strong-font-family:
140-
"JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono", "Courier New", monospace;
174+
"Berkeley Mono", "JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono",
175+
"Courier New", monospace;
141176
--em-font-family:
142-
"JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono", "Courier New", monospace;
177+
"Berkeley Mono", "JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono",
178+
"Courier New", monospace;
143179
--quote-font-family:
144-
"JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono", "Courier New", monospace;
180+
"Berkeley Mono", "JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono",
181+
"Courier New", monospace;
145182

146-
/* Font weights - mapped to JetBrains Mono weights */
183+
/* Font weights — Berkeley Mono provides 400/700, JetBrains Mono fills 300/500/600 */
147184
--font-weight-light: 300;
148185
--font-weight-regular: 400;
149186
--font-weight-medium: 500;
@@ -156,7 +193,8 @@
156193

157194
body {
158195
font-family:
159-
"JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono", "Courier New", monospace;
196+
"Berkeley Mono", "JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono",
197+
"Courier New", monospace;
160198
-webkit-font-smoothing: antialiased;
161199
-moz-osx-font-smoothing: grayscale;
162200
}
@@ -211,7 +249,8 @@ body {
211249

212250
.plan-markdown code {
213251
font-family:
214-
"JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono", "Courier New", monospace;
252+
"Berkeley Mono", "JetBrains Mono", "Monaco", "Menlo", "Ubuntu Mono",
253+
"Courier New", monospace;
215254
font-size: 11px;
216255
background: rgba(0, 0, 0, 0.2);
217256
padding: 0 4px;
@@ -546,7 +585,7 @@ body {
546585
}
547586

548587
.sidebar-tree {
549-
font-family: "JetBrains Mono", monospace;
588+
font-family: "Berkeley Mono", "JetBrains Mono", monospace;
550589
font-size: 12px;
551590
line-height: 1.5;
552591
color: var(--gray-11);

apps/twig/tailwind.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ module.exports = {
4646
},
4747
},
4848
fontFamily: {
49-
mono: ["JetBrains Mono", "Consolas", "Monaco", "monospace"],
49+
mono: [
50+
"Berkeley Mono",
51+
"JetBrains Mono",
52+
"Consolas",
53+
"Monaco",
54+
"monospace",
55+
],
5056
},
5157
},
5258
},

0 commit comments

Comments
 (0)