This document describes how to build and deploy the gem5 Resources website. It is built using Next.js, a React framework for building static and server-side rendered websites.
- Building the Website
- Table of Contents
- Running it Locally
- Building a Static Version
- Automatic Deployment
Firstly, you need to install the dependencies:
npm install
# or
yarn
# or
pnpm install
Next, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 with your browser to see the result.
To build a static version of the website, run the following command:
npm run build
Once the build is complete, you can export the static version of the website using the following command:
npm run export
The static version of the website will be exported to the out
directory.
To serve the static version of the website, you can use any static server. For example, you can use the serve
package:
npm install -g serve
serve out
Go to the "Pages" section of GitHub Settings. If deploying to a custom domain, add that information here.
Our GitHub Actions workflow in .github/workflows/main.yml
automatically deploys a static website to GitHub Pages when changes are pushed to the "main" branch. It utilizes the JamesIves/github-pages-deploy-action action to perform the deployment
The workflow is triggered on the push event, specifically for the main branch, and also allows for manual triggering using the workflow_dispatch event.
The deployment
job runs on the ubuntu-latest
operating system.
Steps:
-
Checkout
: This step uses theactions/checkout
action to checkout the code from the repository. -
Setup Node
: This step uses theactions/setup-node
action to set up Node.js with the specified LTS (Long-Term Support) version and npm cache. -
Install Node Modules
: This step installs the node modules used in this codebase throughnpm ci
. -
Jest
: This step uses Jest.js to run unit test suites on the codebase. -
Cypress run
: This step runs the End-to-End test suite on Cypress. -
Build
: This step performs the following actions:- Runs the build script using
npm run build
. - Exports the build using
npm run export
.
- Runs the build script using
-
Deploy
: This step uses theJamesIves/github-pages-deploy-action
action to deploy the built website to GitHub Pages. It specifies the./out
directory as the publish directory, which is the directory where the built website is exported. The website is exported to thegh-pages
branch.