Skip to content

Commit

Permalink
chore: add script in crement version number by 1 (#10)
Browse files Browse the repository at this point in the history
chore: add script to increment version number by 1
  • Loading branch information
jwilliams-ocient authored Dec 5, 2022
1 parent 0821b4c commit fc7d421
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions scripts/inc_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script
ROOT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/../

# Find the current version
CURRENT_VERSION=$(grep -o "version: .*" ${ROOT_DIR}/resources/metabase-plugin.yaml | cut -c 10-)

# Increment the version
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. -v OFS=. '{$NF += 1 ; print}')

echo "Incrementing version from ${CURRENT_VERSION} to ${NEW_VERSION}"

# Update the version
FILES=(${ROOT_DIR}/resources/metabase-plugin.yaml ${ROOT_DIR}/project.clj)
for i in ${!FILES[@]}; do
sed -i "s/${CURRENT_VERSION}/${NEW_VERSION}/g" ${FILES[$i]}
done

0 comments on commit fc7d421

Please sign in to comment.