alexbassy/site

optimisation: run CI only when code changes

Closed this issue · 0 comments

problem:

CI is run for every change, e.g. README.md

solution:

check if out directory is different in CI

proposed solution/workflow

  • build and export site

  • generate hash of out directory

     find ./out -type f -print0 | xargs -0 sha1sum | sha1sum

    this:

    1. lists the files in the out directory as a long string
    2. generate hash for all files with sha1sum
    3. hash that output, to see if there were any changes
  • compare this with the hash from the previous build

    • if it has changed, upload the hash as a new artifact and continue with the rest of the steps in the workflow
    • if it has not changed, do nothing

why i will not do this

  • premature optimisation
  • might introduce subtle bugs/conditions for deployment?
  • i might want to periodically deploy new builds