How to Deploy from GitHub Automatically on Every Push
Manual deployments are a friction point that compounds over time. The more steps between writing code and seeing it live, the less often you deploy — and the bigger each deployment becomes. Automating deployments from GitHub removes that friction entirely: push code, and your site is updated. Here's how to set it up on PandaStack.
Why Automated Git Deployments Matter
Automated deployments from Git have become a baseline expectation in modern development, and for good reason:
- Consistency — every deploy follows the same process; no "works on my machine" surprises
- Speed — changes go live in minutes, not hours
- Auditability — every deploy corresponds to a Git commit; rollback is trivial
- Confidence — with CI checks in the pipeline, only passing code deploys
- Team velocity — developers stop thinking about deployment mechanics and focus on code
Prerequisites
You'll need:
- A GitHub account with your project repository
- A PandaStack account ([dashboard.pandastack.io](https://dashboard.pandastack.io))
- A project with a build command and a defined output directory
Step 1: Prepare Your Project
Your project needs a build command that produces static files in a predictable directory. Most frameworks handle this automatically:
| Framework | Build Command | Output Directory |
|---|---|---|
| Next.js (static export) | npm run build | out |
| Astro | npm run build | dist |
| Hugo | hugo | public |
| Eleventy | npx eleventy | _site |
| Vite | npm run build | dist |
| Create React App | npm run build | build |
Make sure your package.json (or equivalent) has the correct build script, and that running it locally produces the expected output directory.
Step 2: Add a pandastack.json File
In the root of your repository, create a pandastack.json file:
{
"buildCommand": "npm run build",
"outputDir": "dist",
"type": "static"
}Adjust buildCommand and outputDir to match your framework's values. The type field tells PandaStack what kind of project this is.
This file should be committed to your repository so PandaStack can read it on every deploy.
Step 3: Connect Your GitHub Repository to PandaStack
- 1Log in to [dashboard.pandastack.io](https://dashboard.pandastack.io)
- 2Click New Project and select Static Site
- 3Choose Connect GitHub Repository
- 4Authorize PandaStack to access your GitHub account
- 5Select the repository and the branch you want to deploy from (typically
mainormaster) - 6PandaStack will read your
pandastack.jsonand pre-fill the build settings
Review the detected buildCommand and outputDir, then click Deploy.
Step 4: Trigger Your First Deploy
PandaStack runs your first build immediately after connecting the repository. You'll see the build log in real time in the dashboard — installation of dependencies, execution of the build command, and upload of the output directory.
When the build completes, your site is live at a PandaStack-provided URL.
Step 5: Verify Automatic Deploys
Now the automation is in place. Make any change to your repository:
git add .
git commit -m "Update homepage copy"
git push origin mainReturn to the PandaStack dashboard and you'll see a new build start within seconds of the push. The build runs, completes, and your site is updated — no manual intervention required.
Branch Previews (Recommended)
For team workflows, consider using branch-based deploys. With PandaStack, you can configure additional branches (e.g., staging, develop) to deploy to separate preview URLs. This lets you review changes before merging to main, giving your team a staging environment with zero extra infrastructure.
Handling Build Failures
If a build fails (a missing dependency, a broken build script, or a syntax error), PandaStack keeps the previous successful deployment live. Your production site is never taken down by a failed build. The dashboard shows the build log with the full error output so you can diagnose and fix quickly.
Rolling Back
Every successful deploy corresponds to a Git commit. If a new deploy introduces a problem, you can roll back to a previous commit either by reverting in Git and pushing, or by re-triggering a previous deployment from the PandaStack dashboard.
Summary
Getting automated GitHub deployments working on PandaStack takes three steps: add a pandastack.json with your buildCommand and outputDir, connect your repository in the dashboard, and push. From that point on, every push to your configured branch triggers a build and deploy automatically.
Get started at [dashboard.pandastack.io](https://dashboard.pandastack.io) and read the full documentation at [docs.pandastack.io](https://docs.pandastack.io).