'SBT subprojects: how to test / publish only changed files?

I have a multi-project SBT repo in Github, and I'm using Github Actions to run sbt test and sbt release (using plugin sbt-release and sbt-docker to publish a docker image of each subproject).

I want to be able to detect which files have changed in my PR, and based on that run the test and release actions only on the changed subprojects.

For testing - the benefit would be to save time running them and time reading the logs when there's a failure (shorter logs).

For release - I would like to only publish a new docker image if the subproject actually has changes. I don't want to keep publishing duplicates of the same image (of unchanged subprojects). The main benefit would be version management - to have the published images clearly reflect the changes in the repository.

How can I do that? I did not find any plugin that tries to provide this functionality.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source