This document explains how to deploy the FRC Mechanism Code Generator to various platforms.
GitHub Pages is a free hosting service that makes it easy to deploy static websites directly from a GitHub repository.
-
Build the static site:
pnpm build
-
The static site will be generated in the
outdirectory. -
Push the
outdirectory to thegh-pagesbranch:git add out/ -f git commit -m "Deploy to GitHub Pages" git subtree push --prefix out origin gh-pages -
Configure GitHub Pages in your repository settings to use the
gh-pagesbranch.
You can automate the deployment process using GitHub Actions:
- Create a file at
.github/workflows/deploy.ymlwith the following content:
name: Deploy to GitHub Pages
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: out
branch: gh-pages-
Push this file to your repository.
-
GitHub Actions will automatically build and deploy your site when you push to the main branch.
Before deploying, make sure to update the next.config.mjs file:
/** @type {import('next').NextConfig} */
const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
images: {
unoptimized: true,
},
basePath: '/your-repo-name', // Change this to your repository name
trailingSlash: true,
output: 'export',
distDir: 'out',
};
export default nextConfig;- Push your code to GitHub, GitLab, or Bitbucket.
- Import your repository in Vercel.
- Vercel will automatically detect Next.js and deploy your site.
- Configure the build command to use pnpm:
- Build Command:
pnpm build - Output Directory:
out
- Build Command:
- Push your code to GitHub, GitLab, or Bitbucket.
- Import your repository in Netlify.
- Configure the build settings:
- Build Command:
pnpm build - Publish Directory:
out
- Build Command:
- Add an environment variable:
- Key:
NPM_FLAGS - Value:
--version
- Key:
If you want to use a custom domain:
- Add your domain in your hosting provider's settings.
- Update your DNS settings to point to your hosting provider.
- If using GitHub Pages, create a
CNAMEfile in thepublicdirectory with your domain name.