Maintenance: retry when 'push to netlify' failed
There is some probability of failure to push to netlify using the command line, which seems to be usually due to network reasons.
especially for prod deploy: https://github.com/nolebase/integrations/actions/runs/12101328863/job/33741038395#step:10:130
Since prod deploy doesn't need to get the url, we can use a retry action, for example: https://github.com/zotero-chinese/website/blob/main/.github%2Fworkflows%2Fci.yml#L85-L93
But preview deploy still fails often, this way can't be solved because with retry we can't get the deployed url.
or is there another better way?
Is this because we use Github Actions to push to netlify?
@LittleSound Yes
In my flow, I build the site via GitHub Action and commit the dist to the gh-pages branch of the xxx.github.io repository.
Then, have Netlify link to the gh-pages branch of the xxx.github.io repository.
This has the following benefits:
-
Compile using GitHub Action, avoiding duplicate compilation of Action and Netlify and saving netlify compile time credits.
-
Commit to the xxx.github.io repository, which makes compatibility with github pages very easy.
-
Netlify deployment is done by Netlify, not through netlify-cli, reducing push-to-netlify-like errors.
However, this approach is also only for prod deployments (e.g., ci triggered by push) and does not satisfy preview deployments (e.g., ci triggered by pr)
I think this is a Netlify side issue where we shouldn't put so much our time on it.
And retries can be implemented through other GitHub Actions helper from Marketplace.
We are not limited to use GitHub Actions native functions, it's just too hard to find a well-maintained Action, so feel free to find some, and just replace with it.
Regardless to the GitHub Actions and workflows, we can manually retry from Actions, its not a big problem.