Deploy from GitHub
Connect your GitHub account or organisation once, then pick a repository and branch for each app. NewHost installs your dependencies, runs your build and starts the app on every push. Private repositories work, and GitHub shows each deployment on your commits and pull requests.
1. Connect GitHub
- Open Integrations in the dashboard and click Connect GitHub.
- On GitHub, choose the account or organisation and the repositories NewHost may read: All repositories or Only select repositories. You can change this later with Repository access on the Integrations page.
- GitHub sends you back to NewHost and the account appears under Integrations.
Someone else already installed NewHost on your organisation? Click Already installed? Sign in instead: NewHost links the installations your GitHub user can access. In an organisation where members can't install apps, GitHub asks an owner to approve the request first; connect again once they have.
2. Create an app from a repository
- Go to Node apps → New application and choose the framework.
- Under Source, keep GitHub and pick the account, the repository and the branch to deploy.
- Check the build settings (below) and click Create application. The first deployment starts straight away.
An existing app can switch to a GitHub repository with Connect a GitHub repository on its page.
3. How a deployment runs
- NewHost fetches the commit from GitHub.
- It sets your app's environment variables (from the app page).
- It runs
npm install, unless the install command is empty. - It runs your build command, which must be an npm script, for example
npm run build. - It starts (or restarts) the app from its startup file. A static site is served from its output folder instead.
Every step and its output appear in the deployment log. If a step fails, the deployment stops there and the app is not restarted onto the failed build.
package.json
{
"scripts": {
"build": "next build",
"start": "node .next/standalone/server.js"
}
}| Framework | Build command | Startup file or output folder |
|---|---|---|
| Next.js (standalone output) | npm run build | .next/standalone/server.js |
| Nuxt | npm run build | .output/server/index.mjs |
| Express / Node.js | empty, or your build script | your entry file, e.g. app.js |
| Static site (Vite, Astro) | npm run build | output folder dist |
| Static site (plain HTML) | empty (install empty too) | the folder with your files, or empty for the root |
NEXT_PUBLIC_*, must be set on the app before the deployment runs: they are built into the browser bundle. Never put secrets in them.4. Push to deploy
Every push to the app's branch deploys that commit. Pushes that arrive while a deployment runs wait in the queue, and only the latest waiting push is deployed. Turn push deploys off or on with the button on the app's GitHub card.
With branch previews turned on (Developer plan and up), a push to any other branch deploys that branch to its own address, and deleting the branch removes the preview.
On GitHub, each deployment shows as a NewHost status on the commit and as a deployment in the repository's environments (production, or preview/<branch>), with a link to its log.
5. Follow, cancel and roll back
- Deployments lists every deployment of all your apps. Open one to follow its log while it runs.
- A deployment still waiting in the queue can be cancelled.
- Roll back deploys the commit of an earlier successful deployment again. The next push or redeploy goes back to the latest commit of the branch.
- Redeploy deploys the branch again, for example after changing environment variables.
You can also start deployments from your own tools with the API: see Getting started and the deployment.succeeded and deployment.failed webhooks.
Windows sites
A Windows site can be deployed from a connected repository too: the branch is copied to the site as it is. Commit the files the site serves (static files, PHP, or the output of dotnet publish for .NET sites).
Troubleshooting
- A repository is missing from the list: give the NewHost app access to it under Repository access on the Integrations page.
- "NewHost couldn't get access to the repository": the app was removed from the repository or uninstalled on GitHub. Restore its access and deploy again.
- The build fails: the log shows npm's output above the failed step. Run
npm ci && npm run buildlocally to reproduce it. - Using GitLab or another Git host: create the app with the repository's HTTPS URL instead, and add the webhook shown on the app's page to your Git host.