I cannot create a build hook until I’ve successfully deployed my Staging branch at least once.
EDIT: I noticed after a failed build that the branch became available to create a hook from, and did.
Earlier I had noticed the same thing but when I closed the branch deploy setting panel (or refreshed the page) and tried again, the staging branch was not selectable. Possible issue with Netlify UI?
Right now I’m getting a missing dist folder issue when Netlify tries to deploy the Staging branch and frankly - I don’t really understand why - it should be the default for all branches and just work. At least I thought so.
I suspect the issue is that - to get the Staging branch to start building at all - I had set it to the Production branch in my deploy settings but that just tries to build it in the wrong context. Still doesn’t explain the missing dist folder through.
Is there a way for me to just force a deploy of my Staging branch without having to set it as the Production branch in my deploy settings? Haven’t found a way to do that via UI.
EDIT: After managing to create a hook for my Staging branch the error below still occurs.
Interestingly too, the first attempt for Staging detected no changes so stopped.
I committed a change to the Staging branch and that triggered a build however in Netlify that started a build of Main (as defined in the trigger for Azure DevOps) but also a build for Staging (as per Netlify deploy settings).
Once Main was deployed, Staging kicked in but failed with that missing dist folder error.
EDIT: This still happens. If I commit a change to my Staging branch it appears that BOTH hooks get triggered. Ugh
EDIT: So now I have a hook for each branch AND the correct Netlify context appears in my deployments, but that Dist folder and both Hooks triggering issue are still mysterious (to me) blockers
I pushed the change to my Staging branch at 12.05pm on 30th April (NZT).
The contents of my .toml file is;
# example netlify.toml
command = "npm run generate"
functions = "netlify\functions"
publish = "dist"
# Specific branch context: all deploys from
# this specific branch will inherit these settings.
[context.staging] # “staging” is a branch name
command = "echo 'staging'"
# base = "staging"
BUILD_ENV = "staging"
## Uncomment to use this redirect for Single Page Applications like create-react-app.
## Not needed for static site generators.
# from = "/*"
# to = "/index.html"
# status = 200
## (optional) Settings for Netlify Dev
# command = "yarn start" # Command to start your dev server
# port = 3000 # Port that the dev server will be listening on
# publish = "dist" # Folder with the static content for _redirect file
## more info on configuring this file: https://www.netlify.com/docs/netlify-toml-reference/
Also note that the Staging environment settings are currently identical to Production environment settings since the site and obviously deployment is still being tested.
I’ve tried to keep this setup real simple and just get SSG working first so I know the SEO support is in place.