Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add script to bump all versions #58

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#/bin/bash

update_cargo_toml() {
local file=$1
local new_version=$2
sed -i.bak -E "s/^version = \".*\"/version = \"$new_version\"/" "$file"
rm "${file}.bak"
}

update_package_json() {
local file=$1
local new_version=$2
jq --arg new_version "$new_version" '.version = $new_version' "$file" > tmp.$$.json && mv tmp.$$.json "$file"
}

update_optional_dependencies() {
local file=$1
local new_version=$2
jq --arg new_version "$new_version" '.optionalDependencies |= with_entries(.value = $new_version)' "$file" > tmp.$$.json && mv tmp.$$.json "$file"
}

if ! command -v jq &> /dev/null
then
echo "jq could not be found, please install it to proceed."
exit
fi

if [ -z "$1" ];
then
echo "Usage: $0 <new-version>"
exit 1
fi

NEW_VERSION=$1

update_cargo_toml "Cargo.toml" "$NEW_VERSION"

update_package_json "npm-binary-distributions/darwin/package.json" "$NEW_VERSION"
update_package_json "npm-binary-distributions/linux-arm/package.json" "$NEW_VERSION"
update_package_json "npm-binary-distributions/linux-arm64/package.json" "$NEW_VERSION"
update_package_json "npm-binary-distributions/linux-i686/package.json" "$NEW_VERSION"
update_package_json "npm-binary-distributions/linux-x64/package.json" "$NEW_VERSION"
update_package_json "npm-binary-distributions/win32-i686/package.json" "$NEW_VERSION"
update_package_json "npm-binary-distributions/win32-x64/package.json" "$NEW_VERSION"
update_package_json "packages/supa-mdx-lint/package.json" "$NEW_VERSION"

update_optional_dependencies "packages/supa-mdx-lint/package.json" "$NEW_VERSION"

echo "Version updated to $NEW_VERSION in all manifest files."
Loading