From 47596d5f7247dfc205ae622f831bcf197d1049cb Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Thu, 18 Jul 2024 15:59:31 -0700 Subject: [PATCH] Added a script to help with version bumping --- mix.exs | 3 ++- tooling/version_bump.sh | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 tooling/version_bump.sh diff --git a/mix.exs b/mix.exs index 30b0757..b2d82a5 100644 --- a/mix.exs +++ b/mix.exs @@ -103,7 +103,8 @@ defmodule Pinchflat.MixProject do "ecto.rollback": [ "ecto.rollback", ~s(cmd [ -z "$MIX_ENV" ] && yarn run create-erd || echo "No ERD generated") - ] + ], + "version.bump": "cmd ./tooling/version_bump.sh" ] end end diff --git a/tooling/version_bump.sh b/tooling/version_bump.sh new file mode 100755 index 0000000..09a3c41 --- /dev/null +++ b/tooling/version_bump.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Get the current date in the format YYYY.MM.DD (stripping leading zeros) +DATE=$(date +"%Y.%-m.%-d") + +# Get the current version from mix.exs +VERSION=$(grep "version: " mix.exs | cut -d '"' -f2) + +echo "Bumping version from $VERSION to $DATE" +# Replace the version in mix.exs with the new version +sed -i "s/version: \"$VERSION\"/version: \"$DATE\"/g" mix.exs + +# Run checks to ensure it's a valid mix.exs file +mix check