A small, responsive planet picker built for the GitHub Actions + DevOps college club workshop. Students edit a data file, run the app locally, push a change, watch automated checks, and publish the static website with GitHub Pages.
The browser reads the eight planet entries in public/data/planets.json. Choose a planet to see its short description. The data file is also read by the automated tests.
There are three different jobs in this project:
- Locally, Node.js and Express serve the website so it is easy to run on your computer.
- In CI, Node.js installs dependencies and runs the automated tests.
- Online, GitHub Pages hosts the static HTML, CSS, JavaScript, and JSON files from
public/. GitHub Pages does not run the Express server or host a Node.js backend.
The same static website files are served by Express locally and by GitHub Pages after deployment. No build step is needed. If this project later needed a Node.js server online, it would need a different hosting platform.
- Node.js 26.x and npm. Install the current Node.js 26 release from nodejs.org; npm is included. This matches the workflow.
- Git, a GitHub account, and a code editor.
- Java is not needed. This is a Node.js project.
- Open the instructor's
solar-system-explorertemplate repository on GitHub. - Choose Use this template → Create a new repository.
- Create a repository under your own GitHub account (or the class organization). Give it a name, such as
solar-system-explorer, and choose its visibility according to your instructor's guidance. - Copy the URL for your new repository. Clone that repository, not the instructor's template.
In Terminal, replace each placeholder with your own repository URL and folder name:
git clone <YOUR-REPOSITORY-URL>
cd <YOUR-REPOSITORY-FOLDER>
npm ci
npm run devOpen http://localhost:3000. Leave the terminal running while you explore. Press Ctrl+C to stop the server.
npm ci installs the exact dependency versions recorded in package-lock.json. npm run dev starts Node's built-in watch mode, which restarts the server when server-side files change.
- Open
public/data/planets.jsonin your editor. - Find Earth's
colorvalue, for example"color": "#48a9e6", and change it to another six-digit hex color such as#6c5ce7. - Save, then refresh the browser.
A browser refresh reloads the frontend files and planet data. Server-side code changes can restart automatically in watch mode. Local edits stay on your computer; they do not update GitHub or the deployed website until you commit and push them.
Other beginner challenges:
- Change Earth's display color.
- Update Earth's description.
- Change the page title in
public/index.html(look for the<h1>). - Change the background color in
public/styles.css(look for:rootandbody).
The page header includes a Pipeline demo message. Change its text in public/index.html, save, and refresh the local browser to see your edit. Then run the tests and commit and push that source change to main. The existing workflow starts from the GitHub push, runs the test job, and deploys the updated static page if the tests pass. Find that run under Actions → Latest run.
The page itself does not start GitHub Actions when a visitor clicks or edits something in the browser. The workflow responds to repository events such as commits being pushed. A browser button that triggers a workflow would require a secure server and GitHub credentials; those are outside this static Pages project.
Choose a planet in the Mission Log, optionally add a short note, and select Add to mission log. The new item appears below the form and stays in this browser after a refresh. Use Remove or Clear log to change the list. These visitor-created entries are stored in browser local storage; they do not change the repository and are not shared with GitHub Actions.
The Mission Log feature itself lives in public/index.html, public/styles.css, and public/app.js. When you add or change a feature in these files and push the source change to main, CI runs the tests and CD deploys the new website if they pass. This gives the workshop a visible click interaction and a clear source-code change that travels through the pipeline.
npm testThe tests use Node's built-in test runner. They read the same JSON file as the website and check the planet count, Earth, required fields, unique IDs, and color format. They do not start Express, use the network, or need secrets.
After making your change, run:
git add .
git commit -m "Change Earth display color"
git pushThe first push may ask you to authenticate with GitHub. Make sure your current branch is main, or merge your work into main after reviewing it.
In your repository on GitHub, open Settings → Pages → Build and deployment → Source and select GitHub Actions. The workflow deploys only the public/ folder.
GitHub Pages is available for public repositories on GitHub Free. Private-repository Pages availability depends on the account or organization plan: GitHub Pro, Team, and Enterprise plans support private-repository Pages. Even when the repository itself is private, a published Pages site is publicly available on the internet, so do not put private information in the website. Check the GitHub Pages documentation and your organization's policy.
Open Repository → Actions → Latest run.
- The test job checks out the code, installs Node.js 26 and npm dependencies, then runs
npm test. - The deploy job needs the test job to pass. It only runs for a push to
mainor a manual run onmain; pull requests never deploy. It uploadspublic/as the Pages artifact and publishes it. - This is Continuous Deployment: after CI passes on an eligible main-branch run, the static site publishes automatically without manual approval.
Find the live address in the completed workflow run's deploy job / github-pages environment. It commonly looks like https://YOUR-ACCOUNT.github.io/YOUR-REPOSITORY/. Use the address GitHub reports for your repository.
- In
public/data/planets.json, temporarily change Earth's name toTerra. - Run
npm testand observe the failed Earth check. - For the workshop demonstration, commit and push the broken data to
main. The test job fails, and because deploy needs test to pass, deployment is skipped. The previously published site remains unchanged. - Change the name back to
Earth, runnpm test, then commit and push the fix. After the tests pass, deployment can run again.
Local edit → Local browser refresh → Commit and push → Install dependencies → Run tests → Deploy static website
Open .github/workflows/ci-cd.yml:
onlists events that start the workflow: pushes tomain, pull requests targetingmain, and manual runs.jobsgroups work into independently reported jobs (testanddeploy).runs-onpicks the runner computer, here GitHub'subuntu-latestimage.stepslists tasks in order within a job.usesruns a reusable GitHub Action, such as checking out code or setting up Node.js.runexecutes a shell command such asnpm ci.needsmakes one job wait for another. Heredeployneeds a successfultestjob.permissionslimits what the workflow token can do. Only deployment gets Pages write access and the identity token it needs.environmentrecords the Pages deployment URL, andconcurrencyavoids overlapping deployments.
nodeornpmnot found: install Node.js 26.x from nodejs.org, then close and reopen Terminal. Check withnode --versionandnpm --version.- Port 3000 already in use: stop the other server, or run
PORT=3001 npm run devand open http://localhost:3001. - Invalid JSON: check commas, quotation marks, and brackets in
public/data/planets.json. JSON strings require double quotes; the last array entry must not have a trailing comma. - Tests failing: read the test output, confirm there are eight entries with unique IDs and nonempty fields, and use a color such as
#48a9e6. Descriptions can be edited freely as long as they are nonempty. - Workflow file in the wrong folder: confirm it is named
.github/workflows/ci-cd.yml(including the leading dot directories). - Pages not enabled: set Settings → Pages → Build and deployment → Source to GitHub Actions.
- Missing deployment permissions: confirm the workflow is allowed to use Actions and Pages in repository settings. The deploy job needs
pages: writeandid-token: write; the test job does not. - Old browser content: hard refresh the page or try a private window. Wait for the deployment job to finish before checking the online site.
- Repository-subpath URL problems: keep frontend asset and data URLs relative, like
./styles.cssand./data/planets.json. Avoid leading-slash URLs like/data/planets.json, which point to the domain root rather than your project subpath.