Skip to content

Commit dba64ed

Browse files
Dimitri POSTOLOVsaihaj
andauthored
add open graph images + multi langs + image snapshots tests (#431)
* temp * fix * remove unused * move tests * add tests * fixes * fixes * fixes * fixes * fixes * like this * prettier * lint * ci: job to deploy opengraph service * style: run prettier * add a way to deploy manually * run temp * Revert "run temp" This reverts commit aa13fa5. * increase memory * use the worker * only deploy if service has changed --------- Co-authored-by: Saihajpreet Singh <saihajpreet.singh@gmail.com>
1 parent 9f7e9e0 commit dba64ed

32 files changed

+3135
-108
lines changed

.github/workflows/opengraph.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: OpenGraph Service
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'packages/og-image/**'
8+
9+
workflow_dispatch:
10+
inputs:
11+
commit:
12+
required: false
13+
description: 'Commit ID'
14+
15+
jobs:
16+
deploy:
17+
name: Deploy to Cloudflare Workers
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
ref: ${{ env.COMMIT }}
25+
26+
- uses: the-guild-org/shared-config/setup@main
27+
name: setup env
28+
with:
29+
nodeVersion: 18
30+
packageManager: pnpm
31+
32+
- name: Deploy
33+
working-directory: ./packages/og-image
34+
run: pnpm run deploy
35+
env:
36+
CLOUDFLARE_API_TOKEN: ${{ secrets.GUILD_CLOUDFLARE_API_TOKEN }}
37+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.GUILD_CF_ACCOUNT_ID }}

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@ build/
3737
.eslintcache
3838
dist/
3939
.turbo/
40-
41-
.git
42-
.gitignore
40+
packages/og-image/vender/*.wasm
41+
.wrangler/

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
"pre-commit": "lint-staged --concurrent false",
1717
"pre-push": "pnpm build",
1818
"prepare": "husky install && chmod +x .husky/*",
19-
"prettier": "prettier . --write --list-different",
20-
"prettier:check": "prettier . --check",
19+
"prettier": "pnpm prettier:check --write",
20+
"prettier:check": "prettier --cache --check .",
2121
"start": "pnpm --filter @graphprotocol/docs start",
22+
"test": "turbo run test",
2223
"typecheck": "turbo run typecheck"
2324
},
2425
"devDependencies": {

packages/nextra-theme/src/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ export default function NextraLayout({ children, pageOpts, pageProps }: NextraTh
132132
description: frontMatter.description,
133133
openGraph: {
134134
title,
135-
images: frontMatter.socialImage ? [{ url: frontMatter.socialImage }] : undefined,
135+
images: frontMatter.socialImage
136+
? [{ url: frontMatter.socialImage }]
137+
: [{ url: `https://thegraph-docs-opengraph-image.the-guild.dev?title=${title}` }],
136138
},
137139
}
138140
if (frontMatter.seo) {

0 commit comments

Comments
 (0)