Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't deploy on content-only changes #37

Closed
kentcdodds opened this issue Jul 7, 2021 · 2 comments
Closed

Don't deploy on content-only changes #37

kentcdodds opened this issue Jul 7, 2021 · 2 comments

Comments

@kentcdodds
Copy link
Owner

Content is read from github directly (we'll fallback to local though #36), so there's no reason to deploy the app if the only change made is in content. Thanks to help from @alexanderson1993, I made it pretty far before: 822a168

@kentcdodds
Copy link
Owner Author

The approach I was following in that original attempt is probably sub-optimal. I think what would be best is to get the latest commit from the running app. Some sort of /build-info json endpoint that returns info on the currently running app including the commit sha of the currently deployed commit. Then we can do some git magic to determine all changes from that commit to the one we're building to determine whether anything outside content/ changed.

@kentcdodds
Copy link
Owner Author

kentcdodds commented Sep 2, 2021

This is done. Took a completely different approach. Here's what I said in the remix discord about it:

I finally got content-only changes to not deploy and instantly refresh the cache for the content 🎉

🚀 Don't deploy content-only changes: https://github.com/kentcdodds/remix-kentcdodds/blob/49d4f3f37c35f25fbc5a751ebe2b21fa42b4153c/.github/workflows/deployment.yml#L188-L206

🥬 Refresh content instantly: https://github.com/kentcdodds/remix-kentcdodds/blob/49d4f3f37c35f25fbc5a751ebe2b21fa42b4153c/.github/workflows/refresh-content.yml

Basically, when the site is built, I generate this json file: https://kent.dev/build/info.json during CI, I compare the files that were changed between the last deployed commit with the commit that's being built and use that to determine whether it's content-only.

Most folks don't need to bother with the non-deploy nonsense if they're using a real CMS. But I really like having my content in GitHub so people can make contributions to fix typos and stuff. This is an enormous improvement on my existing site. It took a lot more work, but it's awesome :slight_smile:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant