Skip to content
Merged

misc #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
push:
branches:
- main
paths:
- 'index.html'
- 'clusters.html'
- 'build/**'
- '.github/workflows/ci.yml'
pull_request:
branches:
- main
paths:
- 'index.html'
- 'clusters.html'
- 'build/**'
- '.github/workflows/ci.yml'

defaults:
run:
working-directory: build

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: build/package-lock.json

- name: Install dependencies
run: npm ci

- name: Run build tests
run: npm test
34 changes: 31 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,40 @@ on:
push:
branches:
- Production
paths:
- 'index.html'
- 'clusters.html'
- 'build/**'
- '.github/workflows/deploy.yml'

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: build

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: Production

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: build/package-lock.json

- name: Install dependencies
run: npm ci

- name: Run build tests
run: npm test

deploy:
needs: test
runs-on: ubuntu-latest

steps:
Expand All @@ -22,7 +53,6 @@ jobs:
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H ${{ secrets.DEPLOY_SERVER_IP }} >> ~/.ssh/known_hosts

# Step 1: Deploy Landing Page
- name: Deploy to Landing Directory
run: |
ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no \
Expand All @@ -32,8 +62,6 @@ jobs:
rsync -avz -e "ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no" \
./index.html ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_SERVER_IP }}:/var/www/jarvislandingpage/landing.html

# Step 2: Deploy Clusters Dashboard
# Assuming you have a separate file for the clusters page in your repo
- name: Deploy to Clusters Directory
run: |
ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no \
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/node_modules/
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Instructions for contributors

the repo has two main branches main and Production...do not send prs to the production branch always send them to the main one as that handles the testing on the github pages staging site to catch any major issues before it gets to the production server also

the code that handles the workflow is in the /workflows folder (if you see an issue you are welcome to send a pr for it just please do tag me if you do @bencos17 so that I know)
html pages (`index.html`, `clusters.html`) stay in the repo root. build tests live in `/build`. workflows are in `/.github/workflows` — CI runs automatically on PRs that touch those pages or `build/`

the code that handles the workflow is in the /.github/workflows folder (if you see an issue you are welcome to send a pr for it just please do tag me if you do @bencos17 so that I know)

thanks
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,26 @@ this is using github pages and shows up here
https://jarvis-discordbot.github.io/landing/
the code will auto deploy to production when commited to the production branch (anyone doing dev please push to main and I'll pr to production when it's tested and checked)

## Pages in this repo
## Repo layout

| File | Purpose | Staging (GitHub Pages) | Production |
|------|---------|------------------------|------------|
| `index.html` | Main landing page | Yes | Deployed as `landing.html` via CI |
| `clusters.html` | Live cluster telemetry dashboard | No* | Served from the bot API host (e.g. `clusters.jarvisdiscordbot.net`) |
| `clusters.html` | Live cluster telemetry dashboard | No* | Deployed as `clusters/index.html` via CI |
| `build/` | HTML validation and site checks (`npm test`) | — | Runs in CI before deploy |

\* `clusters.html` fetches `/clusters` on the same origin as the page, so it must be deployed alongside the bot API—not via GitHub Pages. Keep it in this repo for version control; deploy it to the cluster status server separately.
\* `clusters.html` fetches `/clusters` on the same origin as the page, so GitHub Pages staging won't show live data. Production is served from `clusters.jarvisdiscordbot.net`.

## Testing before production

```bash
cd build
npm install
npm test
```

CI runs on pull requests and pushes to `main` when `index.html`, `clusters.html`, or `build/` changes. Pushes to `Production` must pass the same tests before deploy runs.

credits:
1. @bencos17
2. @savvythunder
2. @savvythunder for the animations on the landing page and a few other things on that page also
12 changes: 12 additions & 0 deletions build/.htmlvalidate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": ["html-validate:recommended"],
"rules": {
"require-sri": "off",
"no-inline-style": "off",
"script-type": "off",
"void-style": "off",
"attribute-boolean-style": "off",
"prefer-native-element": "off",
"no-missing-references": "off"
}
}
Loading
Loading