mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2024-12-24 23:29:32 -05:00
Merge branch 'main' into 'main'
bump2version integration See merge request veilid/veilidchat!27
This commit is contained in:
commit
82668ff6a3
20
.bumpversion.cfg
Normal file
20
.bumpversion.cfg
Normal file
@ -0,0 +1,20 @@
|
||||
[bumpversion]
|
||||
current_version = 0.1.2+5
|
||||
commit = False
|
||||
tag = False
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\+(?P<buildcode>\d+)
|
||||
serialize =
|
||||
{major}.{minor}.{patch}+{buildcode}
|
||||
|
||||
[bumpversion:file:pubspec.yaml]
|
||||
search = version: {current_version}
|
||||
replace = version: {new_version}
|
||||
|
||||
[bumpversion:part:major]
|
||||
first_value = 0
|
||||
|
||||
[bumpversion:part:minor]
|
||||
first_value = 0
|
||||
|
||||
[bumpversion:part:patch]
|
||||
first_value = 0
|
@ -1,7 +1,7 @@
|
||||
name: veilidchat
|
||||
description: VeilidChat
|
||||
publish_to: 'none'
|
||||
version: 0.1.2+4
|
||||
version: 0.1.2+5
|
||||
|
||||
environment:
|
||||
sdk: '>=3.2.0 <4.0.0'
|
||||
|
74
version_bump.sh
Executable file
74
version_bump.sh
Executable file
@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Fail out if any step has an error
|
||||
set -e
|
||||
|
||||
if [ "$1" == "patch" ]; then
|
||||
echo Bumping patch version
|
||||
PART=patch
|
||||
elif [ "$1" == "minor" ]; then
|
||||
echo Bumping minor version
|
||||
PART=minor
|
||||
elif [ "$1" == "major" ]; then
|
||||
echo Bumping major version
|
||||
PART=major
|
||||
else
|
||||
echo Unsupported part! Specify 'patch', 'minor', or 'major'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to increment the build code
|
||||
increment_buildcode() {
|
||||
local current_version=$1
|
||||
local major_minor_patch=${current_version%+*}
|
||||
local buildcode=${current_version#*+}
|
||||
local new_buildcode=$((buildcode + 1))
|
||||
echo "${major_minor_patch}+${new_buildcode}"
|
||||
}
|
||||
|
||||
# Function to get the current version from pubspec.yaml
|
||||
get_current_version() {
|
||||
awk '/^version: / { print $2 }' pubspec.yaml
|
||||
}
|
||||
|
||||
# Function to update the version in pubspec.yaml
|
||||
update_version() {
|
||||
local new_version=$1
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
SED_CMD="sed -i ''"
|
||||
else
|
||||
SED_CMD="sed -i"
|
||||
fi
|
||||
eval "$SED_CMD 's/version: .*/version: ${new_version}/' pubspec.yaml"
|
||||
}
|
||||
|
||||
# I pray none of this errors! - I think it should popup an error should that happen..
|
||||
|
||||
current_version=$(get_current_version)
|
||||
|
||||
echo "Current Version: $current_version"
|
||||
|
||||
# Bump the major, minor, or patch version using bump2version
|
||||
bump2version --current-version $current_version $PART
|
||||
|
||||
# Get the new version after bump2version
|
||||
new_version=$(get_current_version)
|
||||
|
||||
# Preserve the current build code
|
||||
buildcode=${current_version#*+}
|
||||
new_version="${new_version%+*}+${buildcode}"
|
||||
|
||||
# Increment the build code
|
||||
final_version=$(increment_buildcode $new_version)
|
||||
|
||||
# Update pubspec.yaml with the final version
|
||||
update_version $final_version
|
||||
|
||||
# Print the final version
|
||||
echo "New Version: $final_version"
|
||||
|
||||
#git add pubspec.yaml
|
||||
#git commit -m "Bump version to $final_version"
|
||||
#git tag "v$final_version"
|
||||
|
Loading…
Reference in New Issue
Block a user