Skip to content

Commit

Permalink
Add GitHub Pages deployment and custom domain configuration
Browse files Browse the repository at this point in the history
* **package.json**
  - Add `gh-pages` to `devDependencies`
  - Add `deploy` script to deploy the frontend to GitHub Pages

* **.github/workflows/deploy.yml**
  - Create a GitHub Actions workflow file to automate deployment to GitHub Pages
  - Use `actions/checkout@v2` to check out the repository
  - Use `actions/setup-node@v2` to set up Node.js
  - Run `npm install` and `npm run deploy` to deploy the frontend

* **404.html**
  - Create a `404.html` file with a simple HTML structure to handle GitHub Pages routing issues

* **CNAME**
  - Create a `CNAME` file for custom domain configuration
  - Add the custom domain name to the `CNAME` file
  • Loading branch information
BradleyMatera committed Oct 26, 2024
1 parent 225a984 commit 51e298e
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Deploy to GitHub Pages
run: npm run deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Not Found</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 50px;
}
h1 {
font-size: 50px;
}
p {
font-size: 20px;
}
</style>
</head>
<body>
<h1>404</h1>
<p>Page Not Found</p>
<p>The page you are looking for does not exist.</p>
</body>
</html>
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example.com
File renamed without changes.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "app/app.js",
"scripts": {
"start": "node app/app.js",
"dev": "nodemon app/app.js"
"dev": "nodemon app/app.js",
"deploy": "gh-pages -d frontend"
},
"keywords": [],
"author": "",
Expand All @@ -18,6 +19,7 @@
"morgan": "^1.10.0"
},
"devDependencies": {
"gh-pages": "^4.0.0",
"nodemon": "^3.0.1"
}
}

0 comments on commit 51e298e

Please sign in to comment.