Skip to Content

Deploy from GitHub

Build and deploy an app from a GitHub repository, through the StackBlaze GitHub App or from any public repository URL.

This guide deploys stackblaze/react-vite-starter, a small public React app, into a new project. StackBlaze builds it from source.

Add a GitHub repository

In your project, click + Service. The menu lists everything you can add to the environment. Choose GitHub repository (Build and deploy from a repo).

The Add to Dev menu: Template, GitHub repository, Docker image, Database or cache and more
The Add to Dev menu: Template, GitHub repository, Docker image, Database or cache and more

Pick the repository

Git repository lists the repositories the StackBlaze GitHub App can see. The menu on the left switches between the GitHub accounts and organizations you installed the app on. Type to search, then click Select next to the repository.

The Git repository dialog, filtered to stackblaze/react-vite-starter, with Select
The Git repository dialog, filtered to stackblaze/react-vite-starter, with Select

The account menu also has Use a public repo (see below).

The account menu: Use a public repo, then the connected GitHub accounts
The account menu: Use a public repo, then the connected GitHub accounts

The gear button next to the search has two items:

  • Refresh reloads the accounts and repositories.
  • Add org / repositories opens GitHub's install page for the StackBlaze GitHub App in a popup. There you choose which accounts and repositories the app can access.
The gear menu: Refresh and Add org / repositories
The gear menu: Refresh and Add org / repositories

Review

The app appears on the canvas as Ready to deploy. Click the card to open the review panel.

The new app card on the canvas: Ready to deploy
The new app card on the canvas: Ready to deploy

Right after you pick a repository, clicking the card can say "Still adding it to the canvas…". Wait a moment and click again.

The review panel shows the repository and what will be deployed:

  • Branch: the menu next to the repository picks the branch to build. This repository only has main.
  • Change goes back to the repository picker.
  • Each app shows its build method and folder, here Railpack (auto-detect, fast rebuilds) · ./.
  • Runtime opens a start command (blank keeps the build's default) and the Port the app listens on.
  • Configure opens the app's full settings: variables, build method, build path, autodeploy, visibility, domains and more. See Service settings.
The review panel: repository and branch, the app with Configure, Runtime, and Add another app from this repo
The review panel: repository and branch, the app with Configure, Runtime, and Add another app from this repo
The branch menu open, listing main
The branch menu open, listing main
Runtime open: start command and Port
Runtime open: start command and Port

Deploy

Click Deploy. StackBlaze builds the app from the repository, then starts it. When the card shows Running, the card shows its public URL on stackblaze.app, with HTTPS.

The app card: Running, with its stackblaze.app URL
The app card: Running, with its stackblaze.app URL
The deployed React app in the browser
The deployed React app in the browser

Deploy several apps from one repository

For a monorepo, add one app per folder. In the review panel, click Add another app from this repo. Root Directory shows the repository's folders; the root is marked Added because it is already in this deploy. Pick a folder, or search for one, and click Add.

Root Directory: the repository's folders, with the root marked Added and src selected
Root Directory: the repository's folders, with the root marked Added and src selected

Deploy a public repository

You don't need the GitHub App for a public repository. In the account menu, choose Use a public repo, paste the repository's HTTPS URL, such as https://github.com/stackblaze/react-vite-starter, and press Enter.

Public repo: Paste any public HTTPS repository and press Enter
Public repo: Paste any public HTTPS repository and press Enter

The app is added to the canvas as Ready to deploy. Click it to open the same review panel, titled Public git repo, and deploy it the same way.

The Public git repo review panel
The Public git repo review panel

After the first deploy

The service follows its branch. Every push to it builds and deploys the new commit while Autodeploy is on (the default). The rules for which pushes build, and how to skip one with [skip deploy] in the commit message, are in How StackBlaze works. Build settings and what detection filled in are in Source and build.

The check on each commit

For a repository connected through the GitHub App, StackBlaze adds a check to each commit it builds. It's named Stackblaze / and the build method, for example Stackblaze / railpack, and its title names the service and where it runs, for example react-vite-starter-4l47 (github-demo-587h/dev). It shows as in progress while the build runs, then as successful, failed or timed out. You can require it in GitHub's branch protection rules.

How StackBlaze sees your repository

Access goes through the StackBlaze GitHub App installation, not a personal token. The App receives the push and pull request events of the repositories you installed it on, so there's no webhook to add to each repository. To stop StackBlaze reading a repository, remove it from the App's repositories on GitHub, or uninstall the App (Add org / repositories opens that page). See Integrations.

Preview environments need the App too, because it's how StackBlaze sees pull requests.

On this page