Skip to content

Commit

Permalink
Version 1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cwilby committed Jan 24, 2024
1 parent 7701f56 commit d73b59d
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Create batch jobs to convert existing media.
]]>
</description>
<version>1.9.0</version>
<version>1.9.1</version>
<licence>agpl</licence>
<author mail="[email protected]" homepage="https://github.com/cwilby">Cameron Wilby</author>
<namespace>WorkflowMediaConverter</namespace>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "workflow_media_converter",
"description": "Workflow for converting media using FFmpeg",
"version": "1.9.0",
"version": "1.9.1",
"author": "Cameron Wilby <[email protected]>",
"license": "agpl",
"private": true,
Expand Down
65 changes: 65 additions & 0 deletions version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

# Define the file paths
PACKAGE_JSON="package.json"
PACKAGE_LOCK_JSON="package-lock.json"
INFO_XML="appinfo/info.xml"

# Function to increment version numbers
increment_version() {
local version=$1
local part=$2
local IFS='.'
read -ra parts <<< "$version"
case $part in
major)
((parts[0]++))
parts[1]=0
parts[2]=0
;;
minor)
((parts[1]++))
parts[2]=0
;;
patch)
((parts[2]++))
;;
esac
echo "${parts[0]}.${parts[1]}.${parts[2]}"
}

# Check if the correct number of arguments is given
if [ "$#" -ne 1 ]; then
echo "Usage: $0 {major|minor|patch}"
exit 1
fi

# Check if the argument is valid
if [[ ! $1 =~ ^(major|minor|patch)$ ]]; then
echo "Error: Argument must be 'major', 'minor', or 'patch'"
exit 1
fi

# Extract the current version from package.json using awk
current_version=$(awk -F'"' '/"version":/ {print $4}' "$PACKAGE_JSON")
if [ -z "$current_version" ]; then
echo "Error: Unable to extract current version from $PACKAGE_JSON"
exit 1
fi

# Increment the version
new_version=$(increment_version "$current_version" "$1")

# Update package.json
sed -i '' "s/\"version\": \"$current_version\"/\"version\": \"$new_version\"/" "$PACKAGE_JSON"

# Update package-lock.json
sed -i '' "s/\"version\": \"$current_version\"/\"version\": \"$new_version\"/" "$PACKAGE_LOCK_JSON"

# Update the empty version property in package-lock.json
sed -i '' "/\"\"/,/}/ s/\"version\": \".*\"/\"version\": \"$new_version\"/" "$PACKAGE_LOCK_JSON"

# Update appinfo/info.xml
sed -i '' "s|<version>$current_version</version>|<version>$new_version</version>|" "$INFO_XML"

echo "Version updated to $new_version"

0 comments on commit d73b59d

Please sign in to comment.