#auto deploy a github repo to netlify
1 messages · Page 1 of 1 (latest)
Hi @green chasm. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
You can automate the deployment of your Astro project from GitHub to Netlify by setting up continuous deployment. Here's how you can do it:
-
Connect your GitHub repository to Netlify. Netlify will use that project to build and deploy your site live on the web every time you commit a change to your code [source (https://docs.astro.build/en/tutorial/1-setup/5#_top)].
-
If your project is stored in GitHub, you can use the Netlify website UI to deploy your Astro site. Click
Add a new sitein your Netlify dashboard (https://app.netlify.com/), chooseImport an existing project, and import your Astro repository from GitHub. Netlify should automatically detect and pre-fill the correct configuration settings for you. Make sure that the following settings are entered, then press theDeploybutton:
* **Build Command:** `astro build` or `npm run build`
* **Publish directory:** `dist`
After deploying, any future changes to your source repository will trigger preview and production deploys based on your deployment configuration [source (https://docs.astro.build/en/guides/deploy/netlify#how-to-deploy)].
- Alternatively, you can use the Netlify CLI to automate the deployment process. Install the Netlify CLI globally using
npm install --global netlify-cli, then runnetlify loginandnetlify initand follow the instructions. Confirm your build command (astro build). The CLI will automatically detect the build settings (astro build) and deploy directory (dist), and will offer to automatically generate anetlify.tomlfile with those settings. Your site will be automatically rebuilt on Netlify every time yougit push[source (https://docs.astro.build/en/guides/deploy/netlify#cli-deployment)].
- If you're using Astro as a static site builder, you don't need an adapter. But if you're deploying a
hybridorserverrendered site, you can use the@astrojs/netlifyadapter to enhance the Astro build process for deployment through Netlify [source (https://docs.astro.build/en/guides/integrations-guide/netlify#_top)].