Publish Your First Website
Publish a portfolio with GitHub Pages and test an automated build gate.
Introduction
30 Second Summary
A portfolio that only lives as files is difficult to share. A public link lets someone see your work the moment you mention it.
In this project, you will turn a GitHub repository template into a public portfolio through GitHub Pages. You will prove that GitHub Actions protects the live site by rejecting a broken update before publishing your repaired headline.
What You'll Build
Picture sharing one URL that opens your working portfolio while every new update waits for a successful automated build.
By the end of this project, you'll have:
- A public portfolio that anyone can open from a shareable browser link.
- A continuous deployment flow that publishes each successful commit automatically.
- A proven deployment gate that keeps the working website live when a broken commit fails its build.
- Secret Mission: Personalize the root-level portfolio.js file with your introduction, About text, and social profile links.
Are there any prerequisites?
You'll need a verified GitHub account before starting the timed route.
You do not need a local editor, Git, Node.js, or terminal setup.
Before We Start
Before the hands-on work begins, this step helps you commit to the portfolio website you are about to publish. You will connect its public URL to someone you want to reach.
Copy the Prepared Starter
Create Your Portfolio Repository
Your portfolio begins as a remote GitHub repository. A local copy gives you a safe place to inspect the starter before placing it under your own account.
In this step, you will check your terminal tools, clone the starter, and push it to a new public repository. You will finish with the files visible in your GitHub account.
In this step, get ready to:
- Confirm that Git, GitHub CLI, and Visual Studio Code are available.
- Clone the portfolio starter and open it in Visual Studio Code.
- Create a public my-portfolio repository and push the starter files.
Check your terminal tools
Git copies and tracks the starter files. GitHub CLI creates the repository from your terminal, while Visual Studio Code gives you one place to work with the files and commands.
- Open Terminal on macOS or PowerShell on Windows through your operating system search.
- Check that Git is available by running this command:
git --version
You should see a line beginning with git version.
✔️ I see a Git version
Git is ready to copy the starter.
ⓧ Git is not found
macOS
The installer can take several minutes and may open an Apple confirmation window.
- Start the Xcode Command Line Tools installer by running this command:
xcode-select --install
- Select Install in the Apple window.
- Wait for the installation to finish.
- Open a fresh Terminal window through Spotlight.
- Check Git again by running this command:
git --version
Windows
Windows may request permission or a package-source agreement during installation. Approve the official Git package prompts to continue.
- Install Git for Windows by running this command in PowerShell:
winget install --id Git.Git -e --source winget
- Close PowerShell after the installation finishes.
- Open a fresh PowerShell window through Windows Search.
- Check Git again by running this command:
git --version
Still can't run Git?
Confirm that the installer finished before opening a fresh terminal. If the command still fails, ask for help checking your Git installation.
- Check that GitHub CLI is available by running this command:
gh --version
You should see a line beginning with gh version.
✔️ I see a GitHub CLI version
GitHub CLI is ready to create your repository.
ⓧ The gh command is not found
macOS
- Install GitHub CLI with Homebrew by running this command:
brew install gh
- Check the installation by running this command:
gh --version
Homebrew is not available?
Use the official GitHub CLI macOS installation guide to choose a supported installer. Then open a fresh Terminal window before checking the version again.
Windows
The installer updates your PATH. You will need to open a new PowerShell window after it finishes.
- Install GitHub CLI by running this command in PowerShell:
winget install --id GitHub.cli --source winget
- Close PowerShell after the installation finishes.
- Open a fresh PowerShell window through Windows Search.
- Check the installation by running this command:
gh --version
Still can't run GitHub CLI?
Open a completely new terminal after installation so it can load the updated PATH. If gh is still unavailable, ask for help checking your GitHub CLI installation.
Clone and open the starter
Cloning downloads every starter file and its Git history. Placing the folder on your Desktop makes it easy to find from both your terminal and editor.
- Move to your Desktop by running this command:
cd ~/Desktop
- Clone the verified starter into my-portfolio and move into that folder by running these commands:
git clone https://github.com/Nik-1019/nextwork-personal-portfolio.git my-portfolio
cd my-portfolio
The download usually finishes within a minute. You should see output ending with a completed checkout.
- Confirm that the starter files exist by running this command:
ls
You should see index.html, portfolio.js, style.css, and script.js.
- Open the current my-portfolio folder in Visual Studio Code by running this command:
code .
✔️ VS Code opened the project
You should see my-portfolio at the top of the Explorer sidebar. The starter files should appear underneath it.
ⓧ The code command did not work
Your terminal cannot find the Visual Studio Code command yet. Use the instructions for your operating system, then try opening the folder again.
macOS
- Press Cmd+Space to open Spotlight.
- Type Visual Studio Code and press Enter.
- Press Cmd+Shift+P in Visual Studio Code to open the Command Palette.
- Run Shell Command: Install 'code' command in PATH.
- Close Terminal.
- Open a fresh Terminal window through Spotlight.
- Move into the cloned folder by running this command:
cd ~/Desktop/my-portfolio
- Open the folder in Visual Studio Code by running this command:
code .
If the command still fails, open Visual Studio Code through Spotlight. Select File, then Open Folder, and choose Desktop/my-portfolio.
Windows
The Visual Studio Code installer adds the code command to PATH. A terminal opened before installation cannot see that update.
- Close PowerShell.
- Open a fresh PowerShell window through Windows Search.
- Move into the cloned folder by running this command:
cd ~/Desktop/my-portfolio
- Open the folder in Visual Studio Code by running this command:
code .
If the command still fails, press the Windows key and search for Visual Studio Code. Open the app, select File, then Open Folder, and choose Desktop\my-portfolio.
Still unable to open the folder?
Confirm that the my-portfolio folder exists on your Desktop. If Visual Studio Code still cannot open it, ask for help checking the code command and folder path.
VS Code opened the wrong folder?
Close the current window and confirm that your terminal path ends in Desktop/my-portfolio. Run the opening command again from that folder.
If the expected files remain missing, ask for help checking your local clone.
Create your GitHub repository
The integrated terminal starts inside the folder already open in Visual Studio Code. This keeps every repository command pointed at my-portfolio.
- Select Terminal in the Visual Studio Code menu bar.
- Select New Terminal.
You should see a terminal panel whose path ends in Desktop/my-portfolio.
Signing in connects this terminal to your GitHub account. The browser flow keeps the credential out of your command history and project files.
- Start GitHub CLI browser authentication by running this command:
gh auth login --web --git-protocol https --clipboard
- ctrl + shift + click the provided link
- Choose Yes if GitHub CLI asks to authenticate Git with your GitHub credentials.
- Press Enter when the terminal displays the one-time code.
- Complete the authorization prompts in your browser.
- Return to the Visual Studio Code terminal after GitHub confirms the authorization.
- Confirm the authenticated account by running this command:
gh auth status
You should see Logged in to github.com account followed by your GitHub username.
Signed in to the wrong account?
Run the login command again and select the GitHub account that should own my-portfolio. If account switching remains unclear, ask for help selecting the correct GitHub CLI account.
Your clone currently calls the starter repository origin. Renaming it to upstream keeps the original source available while freeing origin for your repository.
- Rename the starter remote by running this command:
git remote rename origin upstream
- Confirm the renamed remote by running this command:
git remote -v
You should see upstream beside the starter repository address. The name origin should no longer appear.
Before you run the next command, what do you think will appear under your GitHub account?
- Create the public repository, add it as origin, and push the starter by running this command:
gh repo create my-portfolio --public --source=. --remote=origin --push
This usually finishes within a minute while GitHub creates the repository and receives the files. You should see confirmation that my-portfolio was created and the current branch was pushed.
Repository creation failed?
If GitHub says the name already exists, open that repository in your account and confirm whether it belongs to this project. The project requires the exact my-portfolio name for its website address.
If authentication fails, run the status check again. You can also ask for help creating and pushing the repository.
- Open the new repository in your browser by running this command:
gh repo set-default Nik-1019/my-portfolio
gh repo view --web
You should see the public my-portfolio repository under your GitHub username. Its file list should include index.html, portfolio.js, style.css, and script.js.
That closes the gap. Your starter now lives locally and in a repository owned by your GitHub account.
Your source repository is ready. Next, you will connect it to GitHub Pages and give the portfolio a public website address.
Publish the Starter with GitHub Pages
Your public my-portfolio repository now holds the starter website under your own account.
A repository stores source files. GitHub Pages needs a GitHub Actions workflow to check those files and publish them as a website.
In this step, get ready to:
- Configure GitHub Pages to use a Static HTML workflow.
- Add a JavaScript syntax check before deployment.
- Verify that the starter portfolio loads from its public address.
Configure GitHub Pages
The starter contains plain HTML, CSS, and JavaScript files. GitHub's Static HTML workflow can publish these files without a separate framework build.
- Return to the browser tab showing your my-portfolio repository.
- Select Settings in the repository navigation.
- Select Pages in the sidebar.
- Open the Source dropdown under Build and deployment.
- Select GitHub Actions.
- Find the Static HTML card under the suggested workflows.
- Select Configure on the Static HTML card.
You'll see GitHub's workflow editor with a new .github/workflows/static.yml file. This is the missing workflow that the Actions search could not find earlier.
Add a JavaScript syntax gate
The default Static HTML workflow uploads files without checking their JavaScript. Add a syntax gate so broken JavaScript stops before deployment.
- Press Cmd+A in the workflow editor to select all content in .github/workflows/static.yml.
- Replace the entire content with the complete workflow below:
name: Deploy static content to Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions: { contents: read, pages: write, id-token: write } # Allow Pages deployment.
concurrency: { group: "pages", cancel-in-progress: false } # Keep one deployment active.
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 24
- name: Check JavaScript syntax
run: node --check portfolio.js && node --check script.js
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with: { path: "." } # Upload the complete static site.
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
What does the syntax gate do?
Node.js runs --check against portfolio.js and script.js without executing either file. A syntax error returns a failed status, so the later deployment steps do not run.
- Select Commit changes in the top-right corner.
- Enter Add Pages deployment workflow as the commit message.
- Select Commit changes in the confirmation window.
The first run can take a few minutes while GitHub prepares Pages and deploys the files. A quiet yellow status during this wait is expected.
Workflow failed after the commit?
Open the failed run and select the first step with a red X. If the YAML cannot be read, compare the spacing around the new Node.js steps with the example above.
Help me diagnose my Static HTML workflow.
Verify the first deployment
Before you inspect the workflow, do you expect the unchanged starter files to pass the new syntax gate?
- Select Actions in the repository navigation.
- Select Add Pages deployment workflow in the workflow sidebar.
- Wait for the workflow run to finish.
You'll see a green check. It proves that both JavaScript files passed the syntax gate and GitHub Pages received the deployment.
- Select the deployment URL shown in the completed run.
- Copy the full URL from your browser's address bar.
- Paste the copied URL here: https://your-username.github.io/my-portfolio/.
- Use the portfolio navigation to visit each page.
Your browser loads the starter portfolio at its public address. The navigation works, and the images load without broken placeholders.
Your portfolio is live behind a syntax gate. Next, you'll deliberately break a JavaScript value and watch the workflow protect the working site.
Break and Repair the Deployment Gate
Your starter portfolio is live through GitHub Pages. That first deployment also proved that GitHub Actions can check the source before publishing it.
A green run only proves the happy path. In this step, you'll introduce a JavaScript syntax error so the deployment pipeline must reject the commit before it reaches the live site.
In this step, get ready to:
- Commit a deliberate syntax error from the browser-based editor.
- Inspect the blocked deployment while the working site stays live.
- Repair the headline so the next deployment succeeds.
Break the syntax gate
github.dev is a browser-based editor for files stored in your repository. It lets you change the portfolio without installing a local editor.
- Return to your my-portfolio repository.
- Press . while viewing the repository to open vscode.dev.
- Select portfolio.js in the file sidebar.
- Find this existing headline line:
headline: 'Your headline here. Keep it short.',
- Replace the existing headline line with this experiment:
headline: 'I'm shipping my first site',
What does this edit test?
The apostrophe in I'm closes the single-quoted value too early. The syntax gate should reject the characters that follow it.
Before you commit this edit, do you expect the deployment to succeed or stop at the syntax check?
- Select Source Control in the left sidebar.
- Enter Test the deployment gate as the commit message.
- Select Commit & Push.
Your commit now appears on main. The deployment workflow starts automatically.
Commit and Push unavailable?
Confirm that portfolio.js appears in Source Control. Add the commit message before selecting Commit & Push.
Help me commit the headline experiment.
Inspect the blocked deployment
A deployment gate protects the live site only when invalid source stops before deployment. The workflow history gives you visible evidence of that protection.
Before you open the newest run, do you think GitHub published the commit or stopped it first?
- Use your browser's Back button to return to the my-portfolio repository.
- Select Actions in the repository navigation.
- Select Deploy static content to Pages in the workflow sidebar.
- Wait for the workflow to complete
- Open the newest workflow run.
You'll see a red X. The invalid headline stopped the workflow before GitHub Pages could receive a new deployment.
- Open the failed Check JavaScript syntax step.
You'll see a syntax error that points to portfolio.js. This is the intended failure in the deployment test.
- Open https://your-username.github.io/my-portfolio/ in a new browser tab.
- Refresh the live portfolio.
You'll still see Your headline here. Keep it short. on the live page. The red run proves that the last working deployment survived the broken commit.
Repair and publish the headline
The failed check identified the quote mismatch. Double quotes can surround the full headline while keeping the apostrophe inside the text.
- Switch back to the github.dev tab.
- Find the broken headline in portfolio.js.
headline: 'I'm shipping my first site',
- Replace the broken line with this repaired version:
headline: "I'm shipping my first site",
How does the repair work?
Double quotes now surround the complete value. The apostrophe remains part of the headline, so the file passes the syntax check.
Before you push the repair, do you expect the newest run to show a red X or a green check?
- Select Source Control in the left sidebar.
- Enter Repair headline quoting as the commit message.
- Select Commit & Push.
This deployment can take a few minutes while GitHub checks and uploads the repaired files. Nothing is wrong if the run stays yellow for a short time.
- Return to the repository's Actions tab.
- Select Deploy static content to Pages.
- Open the newest workflow run.
You'll see a green check. The repaired JavaScript passed the gate and reached GitHub Pages.
- Follow the deployment URL from the completed run.
- Refresh the live portfolio homepage.
You'll see I'm shipping my first site as the live headline. The repaired commit has passed the gate and replaced the previous deployment.
Still seeing a failed run?
Return to portfolio.js and confirm that the headline uses double quotes around the complete value.
Confirm that the repair no longer appears as an uncommitted change in Source Control. An uncommitted repair cannot start a new workflow run.
Help me diagnose the repaired workflow.
Strong work. You proved that broken JavaScript stops at the syntax gate while repaired source reaches your live site.
Secret mission
Make the Portfolio Yours
Replace the starter identity in the root-level portfolio.js file with your own public profile. Publish your name, introduction, About text, and social links through the deployment gate you already tested.
Clean Up Your Resources
Clean Up Your Resources
Your public GitHub repository can remain online without ongoing charges on the path used here. Choose whether to keep the site live, unpublish it for now, or delete it completely.
Resources you used:
- Local project folder named my-portfolio on your Desktop.
- Classic personal access token named NextWork portfolio for HTTPS Git authentication.
- Public repository named my-portfolio that stores your personalized portfolio.
- GitHub Pages deployment that serves your personalized site.
- GitHub Actions workflow history that records your deployments.
Keep everything running
No action is needed. Choose this if you are still editing the portfolio and want the site to remain available.
- Keep the my-portfolio folder on your Desktop.
- Leave the my-portfolio repository in your GitHub account.
- Keep the GitHub Pages site published.
- Keep the classic token in your password manager only while you still need it.
- Let the classic token expire on the date you selected.
Pause - I'll come back to this later
Unpublishing hides your site while preserving its code. Delete the temporary token before taking a break so it cannot authenticate future Git operations.
- Return to the my-portfolio repository on GitHub.
- Select Settings in the repository navigation.
- Select Pages in the repository settings.
- Select Unpublish site.
Your live URL stops serving the portfolio. Your repository and local folder remain available.
- Select your profile picture in the GitHub page header.
- Select Settings.
- Select Developer settings in the left sidebar.
- Select Tokens (classic) under Personal access tokens.
- Select Delete beside NextWork portfolio.
The token can no longer authenticate Git requests after deletion.
Delete - I don't want to use this again
Deletion is permanent, so pause here if you may want the code or deployment history later. This option removes the local clone, token, repository, and published site.
Delete the local clone
macOS
- Open Terminal through Spotlight.
- Delete the Desktop copy by running this command:
rm -rf ~/Desktop/my-portfolio
- Confirm the folder is gone by running this command:
ls ~/Desktop
You should no longer see my-portfolio in the output.
Windows
- Open PowerShell through Windows Search.
- Delete the Desktop copy by running this command:
Remove-Item -Recurse -Force "$HOME\Desktop\my-portfolio"
- Confirm the folder is gone by running this command:
Get-ChildItem "$HOME\Desktop"
You should no longer see my-portfolio in the output.
Delete the temporary token
- Select your profile picture in the GitHub page header.
- Select Settings.
- Select Developer settings in the left sidebar.
- Select Tokens (classic) under Personal access tokens.
- Select Delete beside NextWork portfolio.
The token can no longer authenticate Git requests.
Delete the GitHub repository
- Return to the my-portfolio repository on GitHub.
- Select Settings in the repository navigation.
- Scroll to Danger Zone.
- Select Delete this repository.
- Complete GitHub's confirmation controls.
You should no longer be able to open the repository or its GitHub Pages URL.
Nice Work!
Nice Work!
You did it! Your personalized portfolio is live on GitHub Pages. Every committed change now passes an automated GitHub Actions build before visitors see it.
You've learned how to:
- Create your own public my-portfolio repository from a reusable repository template.
- Publish a live portfolio website at https://YOUR-USERNAME.github.io/my-portfolio/. Confirm every page opens from the navigation. Confirm the portfolio images load.
- Prove the deployment gate with a deliberate syntax error. Find the rejected build in the Build step. Repair the headline. Watch the next commit publish successfully.
- Secret Mission: Personalize portfolio.js with your introduction, About text, and social links. Verify each change on the live portfolio.
Ready to quiz yourself?