<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Gabriel Fortuna]]></title><description><![CDATA[Very busy adult with many important things to do]]></description><link>https://blog.gabrielfortuna.net/</link><image><url>https://blog.gabrielfortuna.net/favicon.png</url><title>Gabriel Fortuna</title><link>https://blog.gabrielfortuna.net/</link></image><generator>Ghost 3.42</generator><lastBuildDate>Wed, 18 Mar 2026 18:57:29 GMT</lastBuildDate><atom:link href="https://blog.gabrielfortuna.net/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[A simple script for finding your next version number]]></title><description><![CDATA[<p>Here's a small script that can suggest a version number for an application running on <a href="https://github.com/docker/compose">docker-compose</a>.</p><p>At <a href="https://www.zero-one.io">Zero-One</a> we have quite a few applications that run on docker-compose and use <a href="https://semver.org/">Semantic Versioning</a> when we deploy. Our build script takes a version number as an argument, but it was always a</p>]]></description><link>https://blog.gabrielfortuna.net/a-simple-script-for-finding-your-next-version-number/</link><guid isPermaLink="false">5f04d1c5bcf23d000102d607</guid><dc:creator><![CDATA[Gabriel Fortuna]]></dc:creator><pubDate>Thu, 09 Jul 2020 08:31:42 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1480506132288-68f7705954bd?ixlib=rb-1.2.1&amp;q=80&amp;fm=jpg&amp;crop=entropy&amp;cs=tinysrgb&amp;w=2000&amp;fit=max&amp;ixid=eyJhcHBfaWQiOjExNzczfQ" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1480506132288-68f7705954bd?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=2000&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ" alt="A simple script for finding your next version number"><p>Here's a small script that can suggest a version number for an application running on <a href="https://github.com/docker/compose">docker-compose</a>.</p><p>At <a href="https://www.zero-one.io">Zero-One</a> we have quite a few applications that run on docker-compose and use <a href="https://semver.org/">Semantic Versioning</a> when we deploy. Our build script takes a version number as an argument, but it was always a hassle to find the latest version number so that we could figure out what the next one should be. We would run this command, and then sift through the output, like an animal:</p><pre><code class="language-shell">docker images | grep myfancyapp | sort -V</code></pre><p>This command would yield the following output:</p><figure class="kg-card kg-code-card"><pre><code>myfancyapp   3.09.4   367523bdb502   12 days ago    543 MB
myfancyapp   3.10.0   91f58d9175f7   12 days ago    543 MB
myfancyapp   3.10.1   4a748ae36e7a   12 days ago    543 MB
myfancyapp   3.10.2   6d20954468b6   12 days ago    543 MB
myfancyapp   3.10.3   7f01a6357085   5 days ago     543 MB
myfancyapp   3.11.0   964e5388f5c1   2 days ago     543 MB
myfancyapp   3.11.1   a77d659e4f95   44 hours ago   543 MB
myfancyapp   latest   a77d659e4f95   44 hours ago   543 MB</code></pre><figcaption>Cropped listing of images and their versions</figcaption></figure><p>From there, we'd decide:</p><ul><li><code>4.0.0</code> if it's a Major Version release, or...</li><li><code>3.12.0</code> if it's a Minor Version release, or...</li><li><code>3.11.2</code> if it's a Patch/Bug-fix Version release.</li></ul><p>We now run this simple script, and it gives us a list potential version numbers:</p><figure class="kg-card kg-code-card"><pre><code> ./suggest_version.sh
Versions for myfancyapp

Current image version is:   3.11.1
Current release version is: 3.11.1
---------------------------------
Next major version is: 4.0.0
Next minor version is: 3.12.0
Next patch version is: 3.11.2
</code></pre><figcaption>Output of version suggestion</figcaption></figure><p>We plan to extend our build script to take <code>major</code>, <code>minor</code>, or <code>patch</code> as arguments instead of actual version numbers, and incorporate this script's logic in to save us a step. In the meantime, here's the script, have fun with it, and forgive my poor shell-fu.</p><figure class="kg-card kg-code-card"><pre><code>#!/usr/bin/bash

PROJECT=`basename "$PWD"`
LATEST_VER=`/usr/bin/docker images --filter="reference=$PROJECT" --format="{{.Tag}}" | sort -V | grep "^[0-9]" | tail -1`
REVISION=`cat REVISION`

MAJOR_VER=`echo $LATEST_VER | cut --delimiter="." --fields=1`
MINOR_VER=`echo $LATEST_VER | cut --delimiter="." --fields=2`
PATCH_VER=`echo $LATEST_VER | cut --delimiter="." --fields=3`

NEXT_MAJOR_VER=$((MAJOR_VER+1))
NEXT_MINOR_VER=$((MINOR_VER+1))
NEXT_PATCH_VER=$((PATCH_VER+1))

echo "Versions for $PROJECT"
echo ""
echo "Current image version is:   $LATEST_VER"
echo "Current release version is: $REVISION"
echo "---------------------------------"
echo "Next major version is: $NEXT_MAJOR_VER.0.0"
echo "Next minor version is: $MAJOR_VER.$NEXT_MINOR_VER.0"
echo "Next patch version is: $MAJOR_VER.$MINOR_VER.$NEXT_PATCH_VER"
echo ""</code></pre><figcaption>A simple shell script for determining next version numbers</figcaption></figure>]]></content:encoded></item></channel></rss>