Skip to content

Commit 4e5f873

Browse files
authored
Update to latest website setup and use unified domain (#2247)
1 parent 2b13359 commit 4e5f873

File tree

6 files changed

+623
-56
lines changed

6 files changed

+623
-56
lines changed

.github/workflows/website.yml

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
1-
name: Build website
1+
name: website
2+
23
on:
3-
[push, pull_request]
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
410

511
jobs:
6-
build_website:
7-
name: Build Website
12+
deployment:
813
runs-on: ubuntu-latest
14+
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
915
steps:
10-
- name: Checkout Master
16+
- name: checkout
1117
uses: actions/checkout@v3
12-
- name: Use Node
13-
uses: actions/setup-node@master
1418
with:
15-
node-version: 18
16-
- name: Cache Yarn
17-
uses: actions/cache@v3
19+
fetch-depth: 0
20+
21+
- uses: the-guild-org/shared-config/setup@main
22+
name: setup env
23+
with:
24+
nodeVersion: 18
25+
packageManager: yarn
26+
27+
- uses: the-guild-org/shared-config/website-cf@main
28+
name: build and deploy website
29+
env:
30+
NEXT_BASE_PATH: ${{ github.ref == 'refs/heads/master' && '/graphql/modules' || '' }}
31+
SITE_URL: ${{ github.ref == 'refs/heads/master' && 'https://the-guild.dev/graphql/modules' || '' }}
32+
NEXT_PUBLIC_ALGOLIA_INDEX_NAME: ${{ secrets.NEXT_PUBLIC_ALGOLIA_INDEX_NAME }}
33+
NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY }}
34+
NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_APP_ID }}
1835
with:
19-
path: '**/node_modules'
20-
key: ${{ runner.os }}-18-16-yarn-${{ hashFiles('yarn.lock') }}
21-
restore-keys: |
22-
${{ runner.os }}-18-16-yarn-
23-
- name: Install Dependencies using Yarn
24-
run: yarn install --ignore-engines && git checkout yarn.lock
25-
- name: Build
26-
run: yarn workspace website run build
36+
cloudflareApiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
37+
cloudflareAccountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
38+
githubToken: ${{ secrets.GITHUB_TOKEN }}
39+
projectName: graphql-modules
40+
prId: ${{ github.event.pull_request.number }}
41+
websiteDirectory: ./
42+
buildScript: yarn build && cd website && yarn build && yarn next export
43+
artifactDir: website/out

website/next-sitemap.config.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import('next-sitemap').IConfig} */
2+
3+
module.exports = {
4+
siteUrl: process.env.SITE_URL || 'https://the-guild.dev/graphql/modules',
5+
generateIndexSitemap: false,
6+
};

website/next.config.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
import { withGuildDocs } from '@theguild/components/next.config';
22

3-
export default withGuildDocs();
3+
export default withGuildDocs({
4+
images: {
5+
unoptimized: true, // doesn't work with `next export`
6+
allowFutureImage: true,
7+
},
8+
redirects: () =>
9+
Object.entries({}).map(([from, to]) => ({
10+
source: from,
11+
destination: to,
12+
permanent: true,
13+
})),
14+
});

website/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@
55
"type": "module",
66
"scripts": {
77
"algolia-sync": "node scripts/algolia-ci.mjs",
8-
"dev": "next",
9-
"build": "next build",
8+
"build": "next build && next-sitemap --config next-sitemap.config.cjs ",
9+
"dev": "next dev",
10+
"next": "next",
1011
"start": "next start",
1112
"analyze": "cross-env ANALYZE=true next build"
1213
},
1314
"dependencies": {
1415
"@theguild/components": "4.0.3",
1516
"next": "12.3.1",
17+
"next-sitemap": "3.1.22",
1618
"react": "18.2.0",
17-
"react-dom": "18.2.0"
19+
"react-dom": "18.2.0",
20+
"wrangler": "2.1.5"
1821
},
1922
"browserslist": {
2023
"production": [

website/src/index-page.tsx

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
HeroGradient,
55
HeroIllustration,
66
NPMBadge,
7-
Image,
87
IFeatureListProps,
98
} from '@theguild/components';
109

@@ -13,12 +12,7 @@ import reuse from '../public/assets/img/home/reuse-feat.svg';
1312
import extend from '../public/assets/img/home/extend-feat.svg';
1413
import easy from '../public/assets/img/home/easy-feat.svg';
1514
import rocket from '../public/assets/img/home/rocket.svg';
16-
import apollo from '../public/assets/img/home/companies/apollo-logo.png';
1715
import workers from '../public/assets/img/home/workers-full.svg';
18-
import airFrance from '../public/assets/img/home/companies/airfrance-logo.svg';
19-
import klm from '../public/assets/img/home/companies/klm-logo.svg';
20-
import msj from '../public/assets/img/home/companies/msj-logo.svg';
21-
import schneider from '../public/assets/img/home/companies/schneider-logo.svg';
2216

2317
const FEATURE_LIST: IFeatureListProps['items'] = [
2418
{
@@ -87,35 +81,12 @@ export const IndexPage = (): ReactElement => {
8781
}}
8882
/>
8983

90-
<div className="flex justify-center p-6 md:p-0">
91-
{[
92-
{ src: airFrance, alt: 'AirFrance' },
93-
{ src: klm, alt: 'KLM' },
94-
{ src: msj, alt: 'Mount St. Joseph University' },
95-
{ src: schneider, alt: 'Schneider' },
96-
].map(({ src, alt }) => (
97-
<Image
98-
key={alt}
99-
src={src}
100-
alt={alt}
101-
loading="eager"
102-
placeholder="empty"
103-
/>
104-
))}
105-
</div>
106-
10784
<FeatureList items={FEATURE_LIST} className="[&_h3]:mt-4" />
10885

10986
<HeroIllustration
11087
flipped
111-
title={
112-
<>
113-
Integrates with Your
114-
<Image src={apollo} alt="Apollo" className="inline h-9 w-auto" />
115-
Server
116-
</>
117-
}
118-
description="GraphQL Modules is a set of extra tools, structures and guidelines around the amazing Apollo Server 2.0. You’ll see how effective those tools are once you’ll start growing and scaling your GraphQL server."
88+
title={<>Integrates with any GraphQL Server</>}
89+
description="GraphQL Modules is a set of extra tools, structures and guidelines around your GraphQL schema. You’ll see how effective those tools are once you’ll start growing and scaling your GraphQL server."
11990
image={{
12091
src: workers,
12192
loading: 'eager',

0 commit comments

Comments
 (0)