Question

App static site with GitHub integration reacts to all changes in repo

Hi!

I have specified the following in a digitalocean_app block within my terraform config:

static_site {
  name          = "web"
  build_command = "npm run build"

  source_dir = "web/"

  github {
    branch         = "main"
    deploy_on_push = var.environments[each.key].web.deploy_on_push
    repo = "username/repo"
  }
}

Is there any configuration I can do in order for my app to not build if changes have not been made to my source_dir? I have a monorepo setup and see no point in my static site rebuilding a new version and deploying that if I am making changes to my backend.

Also, if I have deploy_on_push set to false, how do I manually deploy my new version if I push something? I want to autodeploy in dev but control deployments in prod.

BR, Rasmus


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
November 23, 2023

Hi there,

For the DigitalOcean App Platform with a mono repo setup, there is currently no built-in functionality within the platform that allows you to build selectively based on changes in a specific directory.

However, you can implement a workaround using scripts in your build command that check if there are changes in your source_dir and skip the build if there aren’t any.

Regarding manual deployment when deploy_on_push is set to false, you can trigger deployments manually through the DigitalOcean control panel or by using the DigitalOcean API to create a deployment after pushing changes to your repository. This gives you control over when deployments occur in your production environment.

The best thing to do to get your voice heard regarding this would be to head over to our Product Ideas board and post a new idea, including as much information as possible for what you’d like to see implemented.

https://ideas.digitalocean.com/

Hope that helps!

- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel