Skip to content

Commit 9989291

Browse files
committed
github pages
1 parent 69ad97a commit 9989291

File tree

8 files changed

+108
-7
lines changed

8 files changed

+108
-7
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2+
#
3+
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4+
#
5+
name: Deploy docs site to Pages
6+
7+
on:
8+
# Runs on pushes targeting the default branch
9+
push:
10+
branches: ["main"]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
jobs:
28+
# Build job
29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Detect package manager
36+
id: detect-package-manager
37+
run: |
38+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
39+
echo "manager=yarn" >> $GITHUB_OUTPUT
40+
echo "command=install" >> $GITHUB_OUTPUT
41+
echo "runner=yarn" >> $GITHUB_OUTPUT
42+
exit 0
43+
elif [ -f "${{ github.workspace }}/package.json" ]; then
44+
echo "manager=npm" >> $GITHUB_OUTPUT
45+
echo "command=ci" >> $GITHUB_OUTPUT
46+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
47+
exit 0
48+
else
49+
echo "Unable to determine package manager"
50+
exit 1
51+
fi
52+
53+
- name: Setup Node
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version: "22"
57+
cache: ${{ steps.detect-package-manager.outputs.manager }}
58+
59+
- name: Setup Pages
60+
uses: actions/configure-pages@v4
61+
62+
- name: Restore cache
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
.next/cache
67+
# Generate a new cache whenever packages or source files change.
68+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
69+
# If source files changed but packages didn't, rebuild from a prior cache.
70+
restore-keys: |
71+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
72+
73+
- name: Install dependencies
74+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
75+
working-directory: ./docs
76+
77+
- name: Build with Next.js
78+
run: ${{ steps.detect-package-manager.outputs.runner }} next build
79+
working-directory: ./docs
80+
81+
- name: Upload artifact
82+
uses: actions/upload-pages-artifact@v3
83+
with:
84+
path: ./docs/out
85+
86+
# Deployment job
87+
deploy:
88+
environment:
89+
name: github-pages
90+
url: ${{ steps.deployment.outputs.page_url }}
91+
runs-on: ubuntu-latest
92+
needs: build
93+
steps:
94+
- name: Deploy to GitHub Pages
95+
id: deployment
96+
uses: actions/deploy-pages@v4

docs/next.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const nextConfig = {
88
// Configure `pageExtensions` to include markdown and MDX files
99
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
1010
// Optionally, add any other Next.js config below
11+
output: 'export',
12+
basePath: '/react-multi-page-form',
1113
};
1214

1315
async function getConfig() {

docs/src/app/demos/building/validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { z } from 'zod';
22
import type {
33
BuildingPermitApplication,
4-
DocumentReference,
54
ApplicantInformation,
65
ContactInformation,
76
LicenseNumbers,
@@ -41,6 +40,7 @@ import type {
4140
InspectionScheduling,
4241
PostSubmissionRequirements,
4342
} from './data';
43+
import type { DocumentReference } from '@/components/FormLibrary';
4444

4545
// Helper Types
4646
const DocumentReferenceSchema: z.ZodType<DocumentReference> = z.object({

docs/src/app/demos/petrock/sequence.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { EmotionalSupportForm } from './components/EmotionalSupportForm';
1010
import { InsuranceForm } from './components/InsuranceForm';
1111

1212
import type { FormComponentProps, PetRockSystem } from './types';
13-
import type { SequenceChild } from '../../../../src/types';
13+
import type { SequenceChild } from '../../../../../src/types';
1414

1515
// Form sequence
1616
export const pages: SequenceChild<

docs/src/app/demos/petrock/test/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { FormPagesTester } from '../../../../../../src/testUtils/FormPagesTester
44
import { pages } from '../sequence';
55
import { rockyMcSmooth } from '../sampleData';
66

7-
const flattened = flattenPages(pages);
7+
const [flattened] = flattenPages(pages);
88

99
export default function PetRockTest() {
1010
return (

docs/src/app/header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export function Header({ showLogo = true }: HeaderProps) {
1414
<ul className="flex">
1515
{showLogo ? (
1616
<li>
17-
<a href="/">
17+
<Link href="/">
1818
<img
19-
src="/Logo.svg"
19+
src="./Logo.svg"
2020
alt="React Multi Page Form"
2121
className="h-7"
2222
/>
23-
</a>
23+
</Link>
2424
</li>
2525
) : null}
2626
<li>

docs/src/app/layout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export default function RootLayout({
99
}>) {
1010
return (
1111
<html lang="en">
12+
<head>
13+
<base href="/react-multi-page-form/" />
14+
</head>
1215
<body className="antialiased">{children}</body>
1316
</html>
1417
);

docs/src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function () {
55
<div className="container max-w-3xl mx-auto prose p-4">
66
<div className="text-center">
77
<img
8-
src="/Logo.svg"
8+
src="./Logo.svg"
99
alt="React Multi Page Form"
1010
className="h-13"
1111
/>

0 commit comments

Comments
 (0)