Primoz Cigler on Business and Code

This bash script can tell you all software releases in the given date period

At my company, we send monthly updates reports to our clients. They are keen to know which WordPress themes got updates in the last 30 days and what was updated. This means that I have to manually go through all our themes and manually check if the there were any updates for a given theme. We follow semantic versioning and the official theme releases are always tagged in git.

As an engineer, I find it extremely disturbing when I have to do simple repetitive tasks manually. ‘The heck, I can automate this’, I said this week and wrote a simple bash script that simplifies the process. It goes to all the subdirectories which have .git/ subfolder, pulls the latest version of your project and prints out the tags for a given period. You can get in on gist.

How to use it?

  1. Download it to your parent project folder, or in my case wp-content/themes/ and make it executable chmod +x show_releases_from_to.sh
  2. Run it like so ./show_releases_from_to.sh <start-date> <end-date>
    The dates should be in the YYYY-MM-DD format

Example output:

Example output of the show_releases_from_to.sh bash script in terminal

What could be improved?

I confess that I didn’t spend too much time to solve these issues below, because the script solved most of my problem right away. But just in case you wonder, here are possible improvements:

  • Along with tags you also get the pointers to refs/, like branches and remotes and HEAD.
  • Sometimes you don’t tag a release right after you do a commit. Because git log --after and git log --before refer to a commit date, you might miss a release this way.

If you think you can make it better, please do so and let me know, so we can all benefit!

You should follow me on twitter, here.

Author

Primoz

A software engineer transitioning to a digital marketer and entrepreneur. Walking the talk. Windsurfer, digital nomad.